File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -70,14 +70,18 @@ def _conform(self, input_nii: Nifti1Image) -> Nifti1Image:
7070 Args:
7171 input_nii (Nifti1Image): Input NIfTI image to conform.
7272
73+ Raises:
74+ ValueError: If the input NIfTI image does not have a valid affine.
75+
7376 Returns:
7477 A new NIfTI image with conformed shape and affine.
7578 """
7679
7780 shape = np .array (input_nii .shape [:3 ])
7881 affine = input_nii .affine
7982
80- assert affine is not None , "Input NIfTI image must have a valid affine."
83+ if affine is None :
84+ raise ValueError ("Input NIfTI image must have a valid affine." )
8185
8286 # Get corner voxel centers in index coords
8387 corner_centers_ijk = (
@@ -181,7 +185,7 @@ def extract(
181185 device = torch .device (device ) if isinstance (device , str ) else device
182186 model = self ._setup_model (device = device )
183187
184- if device == "cpu" and num_threads > 0 :
188+ if device . type == "cpu" and num_threads > 0 :
185189 torch .set_num_threads (num_threads )
186190
187191 # normalize intensities
You can’t perform that action at this time.
0 commit comments