Skip to content

Commit 6afc8b5

Browse files
Owedaeffigies
Oweda
authored andcommitted
Fix #3654: corrected if statement for saving ROI and ROIs files
1 parent 035bf8d commit 6afc8b5

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

nipype/interfaces/cat12/preprocess.py

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

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

241239
# Templates
@@ -244,64 +242,64 @@ class CAT12SegmentInputSpec(SPMCommandInputSpec):
244242
field="output.ROImenu.atlases.neuromorphometrics",
245243
# usedefault=True,
246244
desc="Extract brain measures for Neuromorphometrics template",
247-
xor=["noROI"],
245+
xor=["noROI"]
248246
)
249247
lpba40 = traits.Bool(
250248
True,
251249
field="output.ROImenu.atlases.lpba40",
252250
# usedefault=True,
253251
desc="Extract brain measures for LPBA40 template",
254-
xor=["noROI"],
252+
xor=["noROI"]
255253
)
256254
cobra = traits.Bool(
257255
True,
258256
field="output.ROImenu.atlases.hammers",
259257
# usedefault=True,
260258
desc="Extract brain measures for COBRA template",
261-
xor=["noROI"],
259+
xor=["noROI"]
262260
)
263261
hammers = traits.Bool(
264262
False,
265263
field="output.ROImenu.atlases.cobra",
266264
# usedefault=True,
267265
desc="Extract brain measures for Hammers template",
268-
xor=["noROI"],
266+
xor=["noROI"]
269267
)
270268
thalamus = traits.Bool(
271269
True,
272270
field="output.ROImenu.atlases.thalamus",
273271
# usedefault=True,
274272
desc="Extract brain measures for Thalamus template",
275-
xor=["noROI"],
273+
xor=["noROI"]
276274
)
277275
thalamic_nuclei = traits.Bool(
278276
True,
279-
field="output.ROImenu.atlases.thalamaic_nuclei",
277+
field="output.ROImenu.atlases.thalamic_nuclei",
280278
# usedefault=True,
281279
desc="Extract brain measures for Thalamic Nuclei template",
282-
xor=["noROI"],
280+
xor=["noROI"]
283281
)
284282
suit = traits.Bool(
285283
True,
286284
field="output.ROImenu.atlases.suit",
287285
# usedefault=True,
288286
desc="Extract brain measures for Suit template",
289-
xor=["noROI"],
287+
xor=["noROI"]
290288
)
291289
ibsr = traits.Bool(
292290
False,
293291
field="output.ROImenu.atlases.ibsr",
294292
# usedefault=True,
295293
desc="Extract brain measures for IBSR template",
296-
xor=["noROI"],
294+
xor=["noROI"]
297295
)
298296
own_atlas = InputMultiPath(
299297
ImageFileSPM(exists=True),
300298
field="output.ROImenu.atlases.ownatlas",
301299
desc="Extract brain measures for a given template",
302300
mandatory=False,
303301
copyfile=False,
304-
xor=["noROI"],
302+
xor=["noROI"]
305303
)
306304
noROI = traits.Bool(
307305
field="output.ROImenu.noROI",
@@ -574,9 +572,10 @@ def _format_arg(self, opt, spec, val):
574572
def _list_outputs(self):
575573
outputs = self._outputs().get()
576574
f = self.inputs.in_files[0]
577-
pth, base, ext = split_filename(f)
578575
if '.nii.gz' in f:
579576
f = f[:-3]
577+
pth, base, ext = split_filename(f)
578+
580579
outputs["mri_images"] = [
581580
str(mri) for mri in Path(pth).glob("mri/*") if mri.is_file()
582581
]
@@ -626,14 +625,17 @@ def _list_outputs(self):
626625
outputs["label_files"] = [
627626
str(label) for label in Path(pth).glob("label/*") if label.is_file()
628627
]
628+
629+
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:
630+
outputs["label_roi"] = fname_presuffix(
631+
f, prefix=os.path.join("label", "catROI_"), suffix=".xml", use_ext=False
632+
)
629633

630-
if self.inputs.noROI:
634+
if self.inputs.surface_and_thickness_estimation:
631635
outputs["label_rois"] = fname_presuffix(
632636
f, prefix=os.path.join("label", "catROIs_"), suffix=".xml", use_ext=False
633637
)
634-
outputs["label_roi"] = fname_presuffix(
635-
f, prefix=os.path.join("label", "catROI_"), suffix=".xml", use_ext=False
636-
)
638+
637639

638640
return outputs
639641

0 commit comments

Comments
 (0)