Struct nblast::NblastArena
source · pub struct NblastArena<N>where
N: TargetNeuron,{ /* private fields */ }
Expand description
Struct for caching a number of neurons for multiple comparable NBLAST queries.
Implementations§
source§impl<N> NblastArena<N>where
N: TargetNeuron + Sync,
impl<N> NblastArena<N>where
N: TargetNeuron + Sync,
sourcepub fn new(score_calc: ScoreCalc, use_alpha: bool) -> Self
pub fn new(score_calc: ScoreCalc, use_alpha: bool) -> Self
By default, runs in serial.
See NblastArena.with_threads
if the “parallel” feature is enabled.
pub fn size_of(&self, idx: NeuronIdx) -> Option<usize>
sourcepub fn add_neuron(&mut self, neuron: N) -> NeuronIdx
pub fn add_neuron(&mut self, neuron: N) -> NeuronIdx
Returns an index which is then used to make queries.
sourcepub fn query_target(
&self,
query_idx: NeuronIdx,
target_idx: NeuronIdx,
normalize: bool,
symmetry: &Option<Symmetry>
) -> Option<Precision>
pub fn query_target( &self, query_idx: NeuronIdx, target_idx: NeuronIdx, normalize: bool, symmetry: &Option<Symmetry> ) -> Option<Precision>
Make a single query using the given indexes.
normalize
divides the result by the self-hit score of the query neuron.
symmetry
, if Some
, also calculates the reverse score
(normalizing it if necessary), and then applies a function to ensure
that the query is symmetric/ commutative.
sourcepub fn queries_targets(
&self,
query_idxs: &[NeuronIdx],
target_idxs: &[NeuronIdx],
normalize: bool,
symmetry: &Option<Symmetry>,
max_centroid_dist: Option<Precision>
) -> HashMap<(NeuronIdx, NeuronIdx), Precision>
pub fn queries_targets( &self, query_idxs: &[NeuronIdx], target_idxs: &[NeuronIdx], normalize: bool, symmetry: &Option<Symmetry>, max_centroid_dist: Option<Precision> ) -> HashMap<(NeuronIdx, NeuronIdx), Precision>
Make many queries using the Cartesian product of the query and target indices.
See query_target for details on normalize
and symmetry
.
Neurons whose centroids are greater than max_centroid_dist
apart will return NaN.
Indices which do not exist will be silently ignored.
sourcepub fn query_target_pairs(
&self,
query_target_idxs: &[(NeuronIdx, NeuronIdx)],
normalize: bool,
symmetry: &Option<Symmetry>,
max_centroid_dist: Option<Precision>
) -> HashMap<(NeuronIdx, NeuronIdx), Precision>
pub fn query_target_pairs( &self, query_target_idxs: &[(NeuronIdx, NeuronIdx)], normalize: bool, symmetry: &Option<Symmetry>, max_centroid_dist: Option<Precision> ) -> HashMap<(NeuronIdx, NeuronIdx), Precision>
See query_target for details on normalize
and symmetry
.
Neurons whose centroids are greater than max_centroid_dist
apart will return NaN.
Indices which do not exist will be silently ignored.
pub fn centroids_within_distance( &self, query_idx: NeuronIdx, target_idx: NeuronIdx, max_centroid_dist: Precision ) -> Option<bool>
pub fn self_hit(&self, idx: NeuronIdx) -> Option<Precision>
sourcepub fn all_v_all(
&self,
normalize: bool,
symmetry: &Option<Symmetry>,
max_centroid_dist: Option<Precision>
) -> HashMap<(NeuronIdx, NeuronIdx), Precision>
pub fn all_v_all( &self, normalize: bool, symmetry: &Option<Symmetry>, max_centroid_dist: Option<Precision> ) -> HashMap<(NeuronIdx, NeuronIdx), Precision>
Query every neuron against every other neuron. See queries_targets for more details.
pub fn is_empty(&self) -> bool
pub fn points( &self, idx: NeuronIdx ) -> Option<impl Iterator<Item = Point3> + '_>
pub fn tangents( &self, idx: NeuronIdx ) -> Option<impl Iterator<Item = Normal3> + '_>
pub fn alphas( &self, idx: NeuronIdx ) -> Option<impl Iterator<Item = Precision> + '_>
Auto Trait Implementations§
impl<N> RefUnwindSafe for NblastArena<N>where
N: RefUnwindSafe,
impl<N> Send for NblastArena<N>where
N: Send,
impl<N> Sync for NblastArena<N>where
N: Sync,
impl<N> Unpin for NblastArena<N>where
N: Unpin,
impl<N> UnwindSafe for NblastArena<N>where
N: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.