pub struct BrainRegion {
pub region_id: RegionID,
pub name: String,
pub region_type: RegionType,
pub cortical_areas: HashSet<CorticalID>,
pub properties: HashMap<String, Value>,
}Expand description
Brain region metadata (genome representation)
A brain region is a hierarchical grouping of cortical areas that share functional or anatomical characteristics. Regions form a tree structure where each region can contain multiple cortical areas and sub-regions.
§Design Notes
- Regions are organizational constructs (not physical entities)
- Used for genome editing, visualization, and bulk operations
- Serializable for genome persistence
- Properties stored as HashMap for maximum flexibility
Fields§
§region_id: RegionIDUnique identifier for this region
name: StringHuman-readable name (mapped to “title” in genome JSON)
region_type: RegionTypeFunctional/anatomical type
cortical_areas: HashSet<CorticalID>Set of cortical area IDs contained in this region
properties: HashMap<String, Value>Additional user-defined properties Commonly used keys: description, coordinate_2d, coordinate_3d, inputs, outputs, signature
Implementations§
Source§impl BrainRegion
impl BrainRegion
Sourcepub fn new(
region_id: RegionID,
name: String,
region_type: RegionType,
) -> Result<BrainRegion, FeagiDataError>
pub fn new( region_id: RegionID, name: String, region_type: RegionType, ) -> Result<BrainRegion, FeagiDataError>
Sourcepub fn with_areas(
self,
areas: impl IntoIterator<Item = CorticalID>,
) -> BrainRegion
pub fn with_areas( self, areas: impl IntoIterator<Item = CorticalID>, ) -> BrainRegion
Create a region with initial cortical areas
Sourcepub fn with_properties(self, properties: HashMap<String, Value>) -> BrainRegion
pub fn with_properties(self, properties: HashMap<String, Value>) -> BrainRegion
Create a region with custom properties
Sourcepub fn add_area(&mut self, area_id: CorticalID) -> bool
pub fn add_area(&mut self, area_id: CorticalID) -> bool
Add a cortical area to this region
Returns true if the area was newly added, false if it was already present
Sourcepub fn remove_area(&mut self, area_id: &CorticalID) -> bool
pub fn remove_area(&mut self, area_id: &CorticalID) -> bool
Remove a cortical area from this region
Returns true if the area was present and removed, false if it wasn’t present
Sourcepub fn contains_area(&self, area_id: &CorticalID) -> bool
pub fn contains_area(&self, area_id: &CorticalID) -> bool
Check if this region contains a specific cortical area
Sourcepub fn get_all_areas(&self) -> Vec<&CorticalID>
pub fn get_all_areas(&self) -> Vec<&CorticalID>
Get all cortical area IDs in this region
Sourcepub fn area_count(&self) -> usize
pub fn area_count(&self) -> usize
Get the number of cortical areas in this region
Sourcepub fn clear_areas(&mut self)
pub fn clear_areas(&mut self)
Clear all cortical areas from this region
Sourcepub fn get_property(&self, key: &str) -> Option<&Value>
pub fn get_property(&self, key: &str) -> Option<&Value>
Get a property value by key
Sourcepub fn add_property(&mut self, key: String, value: Value)
pub fn add_property(&mut self, key: String, value: Value)
Add a property to the region
Trait Implementations§
Source§impl Clone for BrainRegion
impl Clone for BrainRegion
Source§fn clone(&self) -> BrainRegion
fn clone(&self) -> BrainRegion
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BrainRegion
impl Debug for BrainRegion
Source§impl<'de> Deserialize<'de> for BrainRegion
impl<'de> Deserialize<'de> for BrainRegion
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<BrainRegion, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<BrainRegion, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for BrainRegion
impl Serialize for BrainRegion
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for BrainRegion
impl RefUnwindSafe for BrainRegion
impl Send for BrainRegion
impl Sync for BrainRegion
impl Unpin for BrainRegion
impl UnsafeUnpin for BrainRegion
impl UnwindSafe for BrainRegion
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more