oxytcmri.domain.use_cases.compute_lesions_volumes
¶
Classes:
| Name | Description |
|---|---|
BrainLesionsVolume |
Represents the volume of brain lesions for a specific MRI exam, DTI metric, |
BrainLesionsVolumeRepository |
Abstract base class for Brain Lesions Volume repository. |
ComputeBrainLesionsVolumes |
Use-case for computing the volumes of brain lesions in MRI exams. |
Attributes:
| Name | Type | Description |
|---|---|---|
logger |
|
logger = getLogger(__name__)
module-attribute
¶
BrainLesionsVolume(mri_exam_id, dti_metric, region_of_interest, abnormal_value_type, value_ml)
dataclass
¶
Represents the volume of brain lesions for a specific MRI exam, DTI metric, and region of interest.
Attributes:
| Name | Type | Description |
|---|---|---|
mri_exam_id |
MRIExamId
|
The ID of the MRI exam. |
dti_metric |
DTIMetric
|
The DTI metric for which the volume is computed. |
region_of_interest |
Optional[RegionOfInterest]
|
The region of interest for which the volume is computed. |
abnormal_value_type |
AbnormalValueType
|
The type of abnormal value (HIGH or LOW) for which the volume is computed. |
value_ml |
float
|
The computed volume in milliliters (ml) of the brain lesions. |
BrainLesionsVolumeRepository
¶
Bases: Repository[BrainLesionsVolume, None], ABC
Abstract base class for Brain Lesions Volume repository. Defines the interface for retrieving brain lesions volume data.
ComputeBrainLesionsVolumes(repositories_registry, dispatcher=None, overwrite_database=False)
¶
Use-case for computing the volumes of brain lesions in MRI exams.
Initializes the SegmentDtiAbnormalValues use-case.
Methods:
| Name | Description |
|---|---|
compute_all_brain_lesions |
Computes the brain lesions for all patients in the SubjectRepository. |
compute_brain_lesions_associated_to_mri_exam |
Computes the brain lesions associated to a specific MRI exam. |
store_brain_lesions_volume |
Stores the computed brain lesions volume in the repository. |
compute_volume_value |
Computes the volume of brain lesions for a specific MRI exam, DTI metric, and region of interest. |
initialize_progress_bar |
Initialize the progress bar with the total number of steps. |
update_progress_bar |
Updates the progress bar by incrementing the current step. |
Attributes:
Source code in oxytcmri/domain/use_cases/compute_lesions_volumes.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
overwrite_database = overwrite_database
instance-attribute
¶
subjects_repository = repositories_registry.get_repository(Subject)
instance-attribute
¶
mri_repository = repositories_registry.get_repository(MRIExam)
instance-attribute
¶
atlas_repository = repositories_registry.get_repository(Atlas)
instance-attribute
¶
roi_repository = repositories_registry.get_repository(RegionOfInterest)
instance-attribute
¶
brain_lesions_volume_repository = repositories_registry.get_repository(BrainLesionsVolume)
instance-attribute
¶
dispatcher = dispatcher
instance-attribute
¶
current_step = None
instance-attribute
¶
total_steps = None
instance-attribute
¶
compute_all_brain_lesions(dti_metrics, regions_of_interest)
¶
Computes the brain lesions for all patients in the SubjectRepository.
Source code in oxytcmri/domain/use_cases/compute_lesions_volumes.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
compute_brain_lesions_associated_to_mri_exam(mri_exam, dti_metrics, regions_of_interest)
¶
Computes the brain lesions associated to a specific MRI exam.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mri_exam
|
MRIExam
|
The MRI exam for which to compute the brain lesions. |
required |
dti_metrics
|
List[DTIMetric]
|
The DTI metrics for which to compute the brain lesions. |
required |
regions_of_interest
|
List[RegionOfInterest]
|
The supplementary regions of interest to consider for the segmentation. If None, only the whole brain will be considered. |
required |
Source code in oxytcmri/domain/use_cases/compute_lesions_volumes.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
store_brain_lesions_volume(brain_lesions_volume)
¶
Stores the computed brain lesions volume in the repository.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
brain_lesions_volume
|
BrainLesionsVolume
|
The brain lesions volume to store. |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in oxytcmri/domain/use_cases/compute_lesions_volumes.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
compute_volume_value(segmented_dti_map, region_of_interest_mask, abnormal_value_type)
staticmethod
¶
Computes the volume of brain lesions for a specific MRI exam, DTI metric, and region of interest.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
segmented_dti_map
|
DTIAbnormalValues
|
The segmented DTI abnormal values map for the MRI exam. |
required |
region_of_interest_mask
|
Optional[Mask]
|
The mask defining the region of interest for which to compute the volume. If None, no mask is applied (case of the whole brain). |
required |
abnormal_value_type
|
AbnormalValueType
|
The type of abnormal value to compute the volume for (HIGH of LOW). |
required |
Returns:
| Type | Description |
|---|---|
float
|
The computed volume in milliliters (ml) of the brain lesions. |
Source code in oxytcmri/domain/use_cases/compute_lesions_volumes.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | |
initialize_progress_bar(number_of_patients, number_of_dti_metrics, number_of_regions_of_interest)
¶
Initialize the progress bar with the total number of steps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number_of_patients
|
int
|
The number of patients to process. Each patient will have a number of steps equal to the number of DTI metrics multiplied by the number of regions of interest (plus one for the whole brain). |
required |
Source code in oxytcmri/domain/use_cases/compute_lesions_volumes.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | |
update_progress_bar()
¶
Updates the progress bar by incrementing the current step.
Source code in oxytcmri/domain/use_cases/compute_lesions_volumes.py
259 260 261 262 263 264 265 | |