Struct swc_neuron::SwcNeuron

source ·
pub struct SwcNeuron<S: StructureIdentifier, H: Header> {
    pub samples: Vec<SwcSample<S>>,
    pub header: Option<H>,
}
Expand description

Struct representing a neuron skeleton as a tree of SwcSamples.

Fields§

§samples: Vec<SwcSample<S>>§header: Option<H>

Implementations§

source§

impl<S: StructureIdentifier, H: Header> SwcNeuron<S, H>

source

pub fn sort_index(self) -> Self

Sort the neuron’s samples by their index.

source

pub fn reindex(self) -> Result<Self, MissingSampleError>

Re-index the neuron’s samples in order of occurrence, starting at 1. Returns error if the SWC is missing a parent sample

source

pub fn sort_topo(self, reindex: bool) -> Result<Self, InconsistentNeuronError>

Re-order its samples in pre-order depth first search. Children are visited in the order of their original sample number.

Returns an error if the neuron is not a self-consistent tree.

source

pub fn validate( &self, ignore_order: bool ) -> Result<(), InconsistentNeuronError>

Ensure that SwcNeuron is a self-consistent tree.

If ignore_order is true, samples’ parents must be defined before they are.

source

pub fn from_reader<R: Read>(reader: R) -> Result<Self, SwcParseError>

Parse a SwcNeuron from a Reader.

Does not check the neuron for consistency, but does check for valid structures.

source

pub fn to_writer<W: Write>(&self, writer: &mut W) -> Result<(), Error>

Dump this SwcNeuron to a Writer.

source

pub fn replace_header(&mut self, header: Option<H>) -> Option<H>

Replace the existing header with a new one, returning the existing.

Trait Implementations§

source§

impl<S: Clone + StructureIdentifier, H: Clone + Header> Clone for SwcNeuron<S, H>

source§

fn clone(&self) -> SwcNeuron<S, H>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<S: Debug + StructureIdentifier, H: Debug + Header> Debug for SwcNeuron<S, H>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<S: StructureIdentifier, H: Header> FromIterator<SwcSample<S>> for SwcNeuron<S, H>

source§

fn from_iter<I: IntoIterator<Item = SwcSample<S>>>(iter: I) -> Self

Creates a value from an iterator. Read more

Auto Trait Implementations§

§

impl<S, H> RefUnwindSafe for SwcNeuron<S, H>where H: RefUnwindSafe, S: RefUnwindSafe,

§

impl<S, H> Send for SwcNeuron<S, H>where H: Send, S: Send,

§

impl<S, H> Sync for SwcNeuron<S, H>where H: Sync, S: Sync,

§

impl<S, H> Unpin for SwcNeuron<S, H>where H: Unpin, S: Unpin,

§

impl<S, H> UnwindSafe for SwcNeuron<S, H>where H: UnwindSafe, S: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.