bp::object Morphology_getSectionIDs( const MorphologyPtr& morphology, bp::object types ) { const SectionTypes typeVector = vectorFromPython< SectionType >( types, "Cannot convert argument to SectionType list"); return toNumpy( morphology->getSectionIDs( typeVector )); }
bp::object Section_getSamplesFromPositions( const SectionWrapper& section, bp::object points ) { const floats pointVector = vectorFromPython< float >( points, "Cannot convert argument to float vector"); return toNumpy( section.getSamples( pointVector )); }
bp::object CompartmentReportMapping_getIndex( const CompartmentReportMappingProxy& mapping) { static_assert(sizeof(CompartmentReportMapping::IndexEntry) == sizeof(uint32_t) + sizeof(uint32_t), "Bad alignment of IndexEntry"); return toNumpy(mapping.view->getMapping().getIndex(), mapping.view); }
bp::object CompartmentReportMapping_getCompartmentCounts( const CompartmentReportMappingProxy& mapping) { boost::python::list result; auto& counts = mapping.view->getMapping().getCompartmentCounts(); for (auto& count : counts) result.append(toNumpy(count, mapping.view)); return result; }
static np::ndarray segmentBinaryGraph( const np::ndarray & DX, const np::ndarray & DY ) { // Used to evaluate CPMC Matrix<bool,Dynamic,Dynamic,RowMajor> dx = mapMatrixX<bool>(DX), dy = mapMatrixX<bool>(DY); Matrix<short,Dynamic,Dynamic,RowMajor> r = -Matrix<short,Dynamic,Dynamic,RowMajor>::Ones(dx.rows(),dy.cols()); int id=0; std::vector<Vector2i> q; for( int j=0; j<r.rows(); j++ ) for( int i=0; i<r.cols(); i++ ) if( r(j,i) == -1 ){ r(j,i)=id; q.clear(); q.push_back( Vector2i(i,j) ); while(!q.empty()) { int x = q.back()[0], y=q.back()[1]; q.pop_back(); if( x && dx(y,x-1) && r(y,x-1)==-1 ) { r(y,x-1) = id; q.push_back( Vector2i(x-1,y) ); } if( x+1<r.cols() && dx(y,x) && r(y,x+1)==-1 ) { r(y,x+1) = id; q.push_back( Vector2i(x+1,y) ); } if( y && dy(y-1,x) && r(y-1,x)==-1 ) { r(y-1,x) = id; q.push_back( Vector2i(x,y-1) ); } if( y+1<r.rows() && dy(y,x) && r(y+1,x)==-1 ) { r(y+1,x) = id; q.push_back( Vector2i(x,y+1) ); } } id++; if( id > (1<<15) ) throw std::domain_error( "segmentBinaryGraph: Overflow (short)" ); } return toNumpy(r); }
bp::object Soma_getProfilePoints( const SomaWrapper& soma ) { return toNumpy( soma.getProfilePoints( )); }
bp::object Morphology_getTransformation( const MorphologyPtr& morphology ) { return toNumpy( morphology->getTransformation( )); }
bp::object Morphology_getSectionTypes( const MorphologyPtr& morphology ) { return toNumpy( morphology->getSectionTypes( ), morphology ); }
bp::object CompartmentReportView_getGids(const CompartmentReportView& view) { return toNumpy(toVector(view.getGIDs())); }
bp::object CompartmentReport_getGids(const CompartmentReport& report) { return toNumpy(toVector(report.getGIDs())); }
bp::object Circuit_getRotations( const Circuit& circuit, bp::object gids ) { return toNumpy( circuit.getRotations( gidsFromPython( gids ))); }