Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b17ea54

Browse files
author
Oweda
committedJul 1, 2024·
Fix #3654: corrected if statement for saving ROI and ROIs files
1 parent d91f6d2 commit b17ea54

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed
 

Diff for: ‎nipype/interfaces/cat12/preprocess.py

+23-21
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ class CAT12SegmentInputSpec(SPMCommandInputSpec):
112112
'rhe "Optimized Shooting - superlarge ventricles" option for "Spatial registration" is ! '
113113
"required Values: \nnone: 0;\nlight: 1;\nfull: 2;\ndefault: 1070."
114114
)
115-
initial_segmentation = traits.Int(
116-
0, field="extopts.spm_kamap", desc=_help_initial_seg, usedefault=True
117-
)
115+
# initial_segmentation = traits.Int(
116+
# 0, field="extopts.spm_kamap", desc=_help_initial_seg, usedefault=True
117+
# )
118118

119119
_help_las = (
120120
"Additionally to WM-inhomogeneities, GM intensity can vary across different regions such as the motor"
@@ -231,10 +231,8 @@ class CAT12SegmentInputSpec(SPMCommandInputSpec):
231231
surface_measures = traits.Int(
232232
1,
233233
field="output.surf_measures",
234-
# usedefault=True,
234+
usedefault=True,
235235
desc="Extract surface measures",
236-
# requires=["neuromorphometrics", "lpba40", "cobra", "hammers", "thalamus", "thalamic_nuclei", "suit", "ibsr"],
237-
# xor=["noROI"],
238236
)
239237

240238
# Templates
@@ -243,64 +241,64 @@ class CAT12SegmentInputSpec(SPMCommandInputSpec):
243241
field="output.ROImenu.atlases.neuromorphometrics",
244242
# usedefault=True,
245243
desc="Extract brain measures for Neuromorphometrics template",
246-
xor=["noROI"],
244+
xor=["noROI"]
247245
)
248246
lpba40 = traits.Bool(
249247
True,
250248
field="output.ROImenu.atlases.lpba40",
251249
# usedefault=True,
252250
desc="Extract brain measures for LPBA40 template",
253-
xor=["noROI"],
251+
xor=["noROI"]
254252
)
255253
cobra = traits.Bool(
256254
True,
257255
field="output.ROImenu.atlases.hammers",
258256
# usedefault=True,
259257
desc="Extract brain measures for COBRA template",
260-
xor=["noROI"],
258+
xor=["noROI"]
261259
)
262260
hammers = traits.Bool(
263261
False,
264262
field="output.ROImenu.atlases.cobra",
265263
# usedefault=True,
266264
desc="Extract brain measures for Hammers template",
267-
xor=["noROI"],
265+
xor=["noROI"]
268266
)
269267
thalamus = traits.Bool(
270268
True,
271269
field="output.ROImenu.atlases.thalamus",
272270
# usedefault=True,
273271
desc="Extract brain measures for Thalamus template",
274-
xor=["noROI"],
272+
xor=["noROI"]
275273
)
276274
thalamic_nuclei = traits.Bool(
277275
True,
278-
field="output.ROImenu.atlases.thalamaic_nuclei",
276+
field="output.ROImenu.atlases.thalamic_nuclei",
279277
# usedefault=True,
280278
desc="Extract brain measures for Thalamic Nuclei template",
281-
xor=["noROI"],
279+
xor=["noROI"]
282280
)
283281
suit = traits.Bool(
284282
True,
285283
field="output.ROImenu.atlases.suit",
286284
# usedefault=True,
287285
desc="Extract brain measures for Suit template",
288-
xor=["noROI"],
286+
xor=["noROI"]
289287
)
290288
ibsr = traits.Bool(
291289
False,
292290
field="output.ROImenu.atlases.ibsr",
293291
# usedefault=True,
294292
desc="Extract brain measures for IBSR template",
295-
xor=["noROI"],
293+
xor=["noROI"]
296294
)
297295
own_atlas = InputMultiPath(
298296
ImageFileSPM(exists=True),
299297
field="output.ROImenu.atlases.ownatlas",
300298
desc="Extract brain measures for a given template",
301299
mandatory=False,
302300
copyfile=False,
303-
xor=["noROI"],
301+
xor=["noROI"]
304302
)
305303
noROI = traits.Bool(
306304
field="output.ROImenu.noROI",
@@ -573,9 +571,10 @@ def _format_arg(self, opt, spec, val):
573571
def _list_outputs(self):
574572
outputs = self._outputs().get()
575573
f = self.inputs.in_files[0]
576-
pth, base, ext = split_filename(f)
577574
if '.nii.gz' in f:
578575
f = f[:-3]
576+
pth, base, ext = split_filename(f)
577+
579578
outputs["mri_images"] = [
580579
str(mri) for mri in Path(pth).glob("mri/*") if mri.is_file()
581580
]
@@ -625,14 +624,17 @@ def _list_outputs(self):
625624
outputs["label_files"] = [
626625
str(label) for label in Path(pth).glob("label/*") if label.is_file()
627626
]
627+
628+
if self.inputs.neuromorphometrics or self.inputs.lpba40 or self.inputs.cobra or self.inputs.hammers or self.inputs.thalamus or self.inputs.thalamic_nuclei or self.inputs.suit or self.inputs.ibsr:
629+
outputs["label_roi"] = fname_presuffix(
630+
f, prefix=os.path.join("label", "catROI_"), suffix=".xml", use_ext=False
631+
)
628632

629-
if self.inputs.noROI:
633+
if self.inputs.surface_and_thickness_estimation:
630634
outputs["label_rois"] = fname_presuffix(
631635
f, prefix=os.path.join("label", "catROIs_"), suffix=".xml", use_ext=False
632636
)
633-
outputs["label_roi"] = fname_presuffix(
634-
f, prefix=os.path.join("label", "catROI_"), suffix=".xml", use_ext=False
635-
)
637+
636638

637639
return outputs
638640

0 commit comments

Comments
 (0)
Please sign in to comment.