97 std::map<int, std::vector<int>>
edges;
107 std::map<int, std::vector<int>>
getNeighborMap(
const std::map<int, SWCNode>& nodeSet)
const;
128 NeuronGraph(
const std::map<int, SWCNode>& nodeSet);
146 void setNodes(
const std::map<int,SWCNode>& nodeSet);
176 std::map<int, SWCNode>
topologicalSort(
const std::map<int, SWCNode>& nodeSet)
const;
206 bool isSomaMissing(
const std::map<int, SWCNode>& nodeSet)
const;
222 std::map<int, SWCNode>
removeSomaSegment(
const std::map<int, SWCNode>& inputNodes)
const;
238 std::map<int, SWCNode>
setSoma(
const std::map<int, SWCNode>& nodeSet)
const;
256 std::map<int, SWCNode>
preprocess(
const std::map<int, SWCNode> & nodeSet)
const;
274 void writeToFile(
const std::map<int,SWCNode> & nodeSet,
275 const std::string& filename);
311 const std::string& filename);
326 void swc2ugx(
const std::string& inputfile,
const std::string& outputfile);
335 void ugx2swc(
const std::string& inputfile,
const std::string& outputfile);
364 std::map<int, SWCNode>
splitEdges(
const std::map<int, SWCNode>& nodeSet)
const;
379 std::vector<std::map<int, SWCNode>>
splitEdgesN(
const std::map<int, SWCNode>& nodeSet,
int N)
const;
396 std::map<int,std::map<int,SWCNode>>
getTrunks(
const std::map<int,SWCNode>& nodeSet,
bool resetIndex =
false)
const;
402 std::map<int,std::map<int,SWCNode>>
getTrunks(
bool resetIndex =
false)
const {
return this->
getTrunks(this->nodes, resetIndex);};
411 const std::map<
int, std::map<int, SWCNode>>& trunkNodeSets)
const;
420 std::map<int, SWCNode>
assembleTrunks(
const std::map<
int, std::map<int, SWCNode>>& trunkNodeSets)
const;
431 std::map<int, SWCNode>
assembleTrunks(
const std::map<
int, std::map<int, SWCNode>>& resampledTrunks,
432 const std::map<int,int>& trunkParentMap);
480 std::map<int, std::map<int,SWCNode>>
generateRefinements(
const std::map<int,SWCNode>& nodeSet,
483 std::string& method);
491 std::string& method) {
Class for representing and processing neuron morphology graphs.
Definition: neurongraph.h:91
std::map< int, SWCNode > topologicalSort() const
Definition: neurongraph.h:182
bool isTopologicallySorted() const
Definition: neurongraph.h:163
std::map< int, SWCNode > removeSomaSegment() const
Definition: neurongraph.h:228
void writeToFile(const std::string &filename)
Definition: neurongraph.h:281
std::map< int, std::map< int, SWCNode > > allLinearSplineResampledTrunks(std::map< int, std::map< int, SWCNode >> &trunks, double &delta) const
Resamples all trunks using linear interpolation.
Definition: neurontrunks.cpp:281
std::map< int, std::map< int, SWCNode > > allCubicSplineResampledTrunks(std::map< int, std::map< int, SWCNode >> &trunks, double &delta) const
Resamples all trunks using cubic spline interpolation.
Definition: neurontrunks.cpp:318
void readFromFileUGXorSWC(const std::string &filename)
Reads a neuron file, automatically detecting the format.
Definition: neurongraph.cpp:241
std::map< int, SWCNode > nodes
Map of node IDs to SWCNode objects.
Definition: neurongraph.h:94
void ugx2swc(const std::string &inputfile, const std::string &outputfile)
Converts a UGX file to SWC format.
Definition: neurongraph.cpp:289
std::map< int, SWCNode > linearSplineResampleTrunk(const std::map< int, SWCNode > &trunk, double &delta) const
Resamples a single trunk using linear interpolation.
Definition: neurontrunks.cpp:360
void addNode(const SWCNode &node)
Adds a single node to the graph.
Definition: neurongraph.cpp:70
std::map< int, SWCNode > preprocess(const std::map< int, SWCNode > &nodeSet) const
Applies standard preprocessing steps to a set of nodes.
Definition: neurongraph.cpp:94
void writeToFile(const std::map< int, SWCNode > &nodeSet, const std::string &filename)
Writes a set of nodes to an SWC file.
Definition: neurongraph.cpp:198
void setNodes(const std::map< int, SWCNode > &nodeSet)
Replaces the current set of nodes in the graph.
Definition: neurongraph.cpp:50
std::vector< std::map< int, SWCNode > > splitEdgesN(int N) const
Definition: neurongraph.h:385
std::map< int, std::map< int, SWCNode > > generateRefinements(double &delta, int &N, std::string &method)
Definition: neurongraph.h:489
std::map< int, SWCNode > setSoma() const
Definition: neurongraph.h:244
std::map< int, std::map< int, SWCNode > > getTrunks(bool resetIndex=false) const
Definition: neurongraph.h:402
std::map< int, std::vector< int > > getNeighborMap(const std::map< int, SWCNode > &nodeSet) const
Builds a neighbor map from a set of nodes.
Definition: neurontrunks.cpp:46
std::map< int, SWCNode > assembleTrunks(const std::map< int, std::map< int, SWCNode >> &trunkNodeSets) const
Combines multiple trunks into a single node set.
Definition: neurontrunks.cpp:228
void readFromFileUGX(const std::string &filename)
Reads neuron data from a UGX file.
Definition: neuronugx.cpp:244
NeuronGraph(std::string filename)
Constructor that loads a neuron from file.
Definition: neurongraph.h:122
void readFromFile(const std::string &filename)
Reads neuron data from an SWC file.
Definition: neurongraph.cpp:127
void writeToFileUGX(const std::map< int, SWCNode > &nodeSet, const std::string &filename)
Writes a set of nodes to a UGX file.
Definition: neuronugx.cpp:61
int numberOfNodes()
Returns the number of nodes in the graph.
Definition: neurongraph.h:341
std::map< int, int > getTrunkParentMap(const std::map< int, SWCNode > &nodeSet, const std::map< int, std::map< int, SWCNode >> &trunkNodeSets) const
Creates a mapping from trunk IDs to their parent trunk IDs.
Definition: neurontrunks.cpp:171
void writeToFileUGX(const std::string &filename)
Definition: neurongraph.h:317
auto getNodes()
Returns a copy of all nodes in the graph.
Definition: neurongraph.h:353
std::map< int, SWCNode > splitEdges() const
Definition: neurongraph.h:370
std::map< int, std::map< int, SWCNode > > generateRefinements(const std::map< int, SWCNode > &nodeSet, double &delta, int &N, std::string &method)
Generates multiple levels of refined neuron morphologies.
Definition: neurontrunks.cpp:697
std::vector< std::map< int, SWCNode > > splitEdgesN(const std::map< int, SWCNode > &nodeSet, int N) const
Applies edge splitting N times recursively.
Definition: neuronoperations.cpp:193
NeuronGraph()
Default constructor.
Definition: neurongraph.h:114
int numberOfEdges()
Returns the number of edges in the graph.
Definition: neurongraph.h:347
bool hasSomaSegment() const
Definition: neurongraph.h:197
bool isSomaMissing() const
Definition: neurongraph.h:212
std::map< int, SWCNode > cubicSplineResampleTrunk(const std::map< int, SWCNode > &trunk, double &delta) const
Resamples a single trunk using cubic spline interpolation.
Definition: neurontrunks.cpp:458
std::map< int, std::map< int, SWCNode > > getTrunks(const std::map< int, SWCNode > &nodeSet, bool resetIndex=false) const
Extracts trunk segments from a neuron morphology.
Definition: neurontrunks.cpp:85
std::map< int, std::vector< int > > edges
Adjacency list representation of the neuron graph.
Definition: neurongraph.h:97
void swc2ugx(const std::string &inputfile, const std::string &outputfile)
Converts an SWC file to UGX format.
Definition: neurongraph.cpp:268
float delta
Definition: test_bindings.py:66
Structure representing a single node in an SWC neuron morphology.
Definition: neurongraph.h:43
double z
Z-coordinate in 3D space.
Definition: neurongraph.h:70
double radius
Radius of the neural process at this node.
Definition: neurongraph.h:73
int pid
Parent node ID (-1 for root nodes)
Definition: neurongraph.h:48
int type
Node type identifier.
Definition: neurongraph.h:61
int id
Unique identifier for the node.
Definition: neurongraph.h:45
double x
X-coordinate in 3D space.
Definition: neurongraph.h:64
double y
Y-coordinate in 3D space.
Definition: neurongraph.h:67