pub struct StatsModelsGraph {
pub name: String,
pub description: String,
pub nodes: Vec<StatsModelsNode>,
pub edges: Vec<StatsModelsEdge>,
/* private fields */
}Expand description
Rooted directed acyclic graph representing a BIDS-StatsModel specification.
A StatsModelsGraph is loaded from a JSON file conforming to the
BIDS-StatsModels
specification. It contains analysis nodes at different levels of the
BIDS hierarchy (run, session, subject, dataset) connected by edges
that define how contrasts and data flow between levels.
§Lifecycle
- Load — Parse from JSON file or value via
from_file()orfrom_json() - Validate — Check structure via
validate() - Load data — Populate nodes with variables from a layout via
load_collections() - Execute — Run the analysis pipeline via
run() - Export — Generate DOT graph via
write_graph()
Corresponds to PyBIDS’ StatsModelsGraph class.
Fields§
§name: String§description: String§nodes: Vec<StatsModelsNode>§edges: Vec<StatsModelsEdge>Implementations§
Source§impl StatsModelsGraph
impl StatsModelsGraph
Sourcepub fn from_json(model_json: &Value) -> Result<Self>
pub fn from_json(model_json: &Value) -> Result<Self>
Load from a JSON model spec (path or parsed value).
Sourcepub fn get_node(&self, name: &str) -> Option<&StatsModelsNode>
pub fn get_node(&self, name: &str) -> Option<&StatsModelsNode>
Get a node by name.
Sourcepub fn root_node(&self) -> &StatsModelsNode
pub fn root_node(&self) -> &StatsModelsNode
Get the root node.
Sourcepub fn load_collections(&mut self, layout: &BidsLayout)
pub fn load_collections(&mut self, layout: &BidsLayout)
Load collections from a layout into all nodes.
Sourcepub fn write_graph(&self) -> String
pub fn write_graph(&self) -> String
Write graph structure as a DOT file (text-based graphviz).
Sourcepub fn render_graph(&self, output_path: &Path, format: &str) -> Result<()>
pub fn render_graph(&self, output_path: &Path, format: &str) -> Result<()>
Render graph to a file using the dot command (requires graphviz installed).
Sourcepub fn run(&self) -> Vec<StatsModelsNodeOutput>
pub fn run(&self) -> Vec<StatsModelsNodeOutput>
Run the entire graph recursively.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StatsModelsGraph
impl RefUnwindSafe for StatsModelsGraph
impl Send for StatsModelsGraph
impl Sync for StatsModelsGraph
impl Unpin for StatsModelsGraph
impl UnsafeUnpin for StatsModelsGraph
impl UnwindSafe for StatsModelsGraph
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
Mutably borrows from an owned value. Read more