voxel_data_adapters
oxytcmri.interface.mri.voxel_data_adapters
¶
NIfTI adapter implementations.
Classes:
Name | Description |
---|---|
InMemoryNumpyVoxelData |
Voxel data stored in memory as a numpy array. |
NiftiVoxelData |
Implementation of VoxelData for NIfTI files. |
Attributes:
Name | Type | Description |
---|---|---|
T |
|
T = TypeVar('T')
module-attribute
¶
InMemoryNumpyVoxelData(data=None, voxel_volume=None)
¶
Voxel data stored in memory as a numpy array.
Initialize the InMemoryNumpyVoxelData object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
ndarray
|
Numpy array containing voxel data. |
None
|
Methods:
Name | Description |
---|---|
get_value_at |
Get the value at the specified coordinates. |
get_dimensions |
Get the dimensions of the voxel data. |
get_voxel_volume_in_ml |
Get the volume of a voxel in milliliters. |
filter_values |
Create a boolean representation of voxel data based on a filtering condition. |
Source code in oxytcmri/interface/mri/voxel_data_adapters.py
17 18 19 20 21 22 23 24 25 26 |
|
get_value_at(x, y, z)
¶
Get the value at the specified coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
int
|
X coordinate. |
required |
y
|
int
|
Y coordinate. |
required |
z
|
int
|
Z coordinate. |
required |
Returns:
Type | Description |
---|---|
T
|
Value at the specified coordinates. |
Source code in oxytcmri/interface/mri/voxel_data_adapters.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
get_dimensions()
¶
Get the dimensions of the voxel data.
Returns:
Type | Description |
---|---|
Tuple[int, int, int]
|
Dimensions of the voxel data (x, y, z). |
Source code in oxytcmri/interface/mri/voxel_data_adapters.py
47 48 49 50 51 52 53 54 55 |
|
get_voxel_volume_in_ml()
¶
Get the volume of a voxel in milliliters.
Returns:
Type | Description |
---|---|
float
|
Volume of a voxel in milliliters. |
Source code in oxytcmri/interface/mri/voxel_data_adapters.py
57 58 59 60 61 62 63 64 65 |
|
filter_values(condition)
¶
Create a boolean representation of voxel data based on a filtering condition.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
condition
|
Callable[[T], bool]
|
Function that takes a voxel value and returns True if the voxel should be included in the filter |
required |
Returns:
Type | Description |
---|---|
VoxelData[bool]
|
A boolean representation where voxels are True if they match the condition |
Source code in oxytcmri/interface/mri/voxel_data_adapters.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
NiftiVoxelData(nifti_path)
¶
Implementation of VoxelData for NIfTI files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nifti_path
|
Path
|
Path to the NIfTI file. |
required |
Initialize the NiftiVoxelData object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nifti_path
|
Path
|
Path to the NIfTI file. |
required |
Methods:
Name | Description |
---|---|
get_nifti_image |
Get the NIfTI image object. |
get_data |
Get the voxel data as a numpy array. |
get_nifti_path_string |
Get the path to the NIfTI file as a string. |
get_value_at |
Get the value at the specified coordinates. |
get_dimensions |
Get the dimensions of the voxel data. |
get_voxel_volume_in_ml |
Get the volume of a single voxel in milliliters (mL). |
filter_values |
Filter the voxel data based on a condition. |
Attributes:
Name | Type | Description |
---|---|---|
nifti_path |
|
Source code in oxytcmri/interface/mri/voxel_data_adapters.py
93 94 95 96 97 98 99 100 101 102 |
|
nifti_path = nifti_path
instance-attribute
¶
get_nifti_image()
¶
Get the NIfTI image object.
Returns:
Type | Description |
---|---|
Nifti1Image
|
NIfTI image object. |
Source code in oxytcmri/interface/mri/voxel_data_adapters.py
104 105 106 107 108 109 110 111 112 |
|
get_data()
¶
Get the voxel data as a numpy array.
Returns:
Type | Description |
---|---|
ndarray
|
Voxel data as a numpy array. |
Source code in oxytcmri/interface/mri/voxel_data_adapters.py
114 115 116 117 118 119 120 121 122 123 124 125 |
|
get_nifti_path_string()
¶
Get the path to the NIfTI file as a string.
Returns:
Type | Description |
---|---|
str
|
Path to the NIfTI file. |
Source code in oxytcmri/interface/mri/voxel_data_adapters.py
127 128 129 130 131 132 133 134 135 |
|
get_value_at(x, y, z)
¶
Get the value at the specified coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
int
|
X coordinate. |
required |
y
|
int
|
Y coordinate. |
required |
z
|
int
|
Z coordinate. |
required |
Returns:
Type | Description |
---|---|
T
|
Value at the specified coordinates. |
Source code in oxytcmri/interface/mri/voxel_data_adapters.py
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 |
|
get_dimensions()
¶
Get the dimensions of the voxel data.
Returns:
Type | Description |
---|---|
Tuple[int, int, int]
|
Dimensions of the voxel data (x, y, z). |
Source code in oxytcmri/interface/mri/voxel_data_adapters.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
|
get_voxel_volume_in_ml()
¶
Get the volume of a single voxel in milliliters (mL).
1 mL = 1000 mm³
Returns:
Type | Description |
---|---|
float
|
Volume of a single voxel in milliliters (mL). |
Source code in oxytcmri/interface/mri/voxel_data_adapters.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
|
filter_values(condition)
¶
Filter the voxel data based on a condition.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
condition
|
Callable[[T], bool]
|
A function that takes a voxel value and returns True if the voxel should be included in the filter. |
required |
Returns:
Type | Description |
---|---|
VoxelData[bool]
|
A boolean representation where voxels are True if they match the condition |
Source code in oxytcmri/interface/mri/voxel_data_adapters.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
|