Example¶
This example demonstrates how to use the cardiotensor package with the example provided in the repository. This example will help you understand how to process input data, compute fiber orientations, and visualize results.
Example Directory Overview¶
The ./examples/ directory contains:
- Datasets: Cropped 3D volumes and binary masks for testing and experimentation.
- Configuration File: A pre-filled
parameters_example.conffile for running the workflows.
Data¶
-
Heart Volume:
- Path:
./data/635.2um_LADAF-2021-17_heart_overview_/ - Description: A downsampled 3D heart image volume designed for testing. The full-resolution dataset is available at the Human Organ Atlas.
- Path:
-
Binary Mask:
- Path:
./data/mask/ - Description: A binary mask used for segmenting the heart from the background.
- Path:
Running the Examples¶
Installation¶
Note
See Installation
-
Clone the repository and install the package:
-
Navigate to the
examplesdirectory:
Processing a Test Slice¶
- Open
parameters_example.confand setTEST = Truein the[TEST]section.
Note
For information about conf file see the section Configuration file
- Run the following command:
- The output will be displayed as a plot for a single slice:
Processing the Entire Volume¶
- Set
TEST = Falseinparameters_example.conf.
Note
For information about conf file see the section Configuration file
- Run the command:
- Outputs will be saved in the
./outputdirectory with the following structure:
Visualizing Transmural Profiles¶
-
Use the
Replacecardio-analysiscommand:150with the slice number you wish to analyze. -
The GUI will appear, allowing you to:
- Define a transmural profile line.
- Adjust parameters like
Angle rangeandNumber of lines. - Plot and export the profile.
Graphical interface for defining transmural profiles.
The generated profile will resemble:
Example of a generated transmural profile.
Visualizing Vector field¶
Note
WRITE_VECTORS must be equal to True in the Configuration file
Once the structure tensor and eigenvectors have been calculated on the whole volume.
-
Use the
cardio-visualize-vectorcommand:-
--start: Show vectors only from slice 120 to the last slice. -
--stride 6: Show only 1 vector out of every 6.
-
-
The plot will appear and you will be able to rotate it by dragging left click
Vector field visualization from computed structure tensors using Fury.
Generating and visualizing streamlines¶
-
Use the
cardio-visualize-vectorcommand to generate the streamlines:-
--start: Show vectors only from slice 120 to the last slice. -
--seeds: Number of seeds to start streamlines
Note
The streamlines are generated in
output/streamlines.trk -
-
Use the
cardio-visualize-streamlinescommand to plot the streamlines:--line-width: The width of the streamline in the plot.
Notes¶
- The provided dataset is for demonstration purposes only.
- Modify parameters in
parameters_example.conf(e.g.,SIGMA,RHO) to suit your data.