Skip to content

Commit 839931f

Browse files
author
Oweda
committed
FIX Issue nipy#3654: added missing input traits for templates, corrected if statements for when no surface or ROI estimations are desired
1 parent 3f9a039 commit 839931f

File tree

1 file changed

+62
-30
lines changed

1 file changed

+62
-30
lines changed

nipype/interfaces/cat12/preprocess.py

+62-30
Original file line numberDiff line numberDiff line change
@@ -225,46 +225,86 @@ class CAT12SegmentInputSpec(SPMCommandInputSpec):
225225
" are not available as batch dependencies objects. "
226226
)
227227
surface_and_thickness_estimation = traits.Int(
228-
1, field="surface", desc=_help_surf, usedefault=True
228+
1, field="output.surface", desc=_help_surf, usedefault=True
229229
)
230230
surface_measures = traits.Int(
231231
1,
232232
field="output.surf_measures",
233-
usedefault=True,
233+
# usedefault=True,
234234
desc="Extract surface measures",
235+
# requires=["neuromorphometrics", "lpba40", "cobra", "hammers", "thalamus", "thalamic_nuclei", "suit", "ibsr"],
236+
# xor=["noROI"],
235237
)
236238

237239
# Templates
238240
neuromorphometrics = traits.Bool(
239241
True,
240242
field="output.ROImenu.atlases.neuromorphometrics",
241-
usedefault=True,
243+
# usedefault=True,
242244
desc="Extract brain measures for Neuromorphometrics template",
245+
xor=["noROI"],
243246
)
244247
lpba40 = traits.Bool(
245248
True,
246249
field="output.ROImenu.atlases.lpba40",
247-
usedefault=True,
250+
# usedefault=True,
248251
desc="Extract brain measures for LPBA40 template",
252+
xor=["noROI"],
249253
)
250254
cobra = traits.Bool(
251255
True,
252256
field="output.ROImenu.atlases.hammers",
253-
usedefault=True,
257+
# usedefault=True,
254258
desc="Extract brain measures for COBRA template",
259+
xor=["noROI"],
255260
)
256261
hammers = traits.Bool(
257-
True,
262+
False,
258263
field="output.ROImenu.atlases.cobra",
259-
usedefault=True,
264+
# usedefault=True,
260265
desc="Extract brain measures for Hammers template",
266+
xor=["noROI"],
267+
)
268+
thalamus = traits.Bool(
269+
True,
270+
field="output.ROImenu.atlases.thalamus",
271+
# usedefault=True,
272+
desc="Extract brain measures for Thalamus template",
273+
xor=["noROI"],
274+
)
275+
thalamic_nuclei = traits.Bool(
276+
True,
277+
field="output.ROImenu.atlases.thalamaic_nuclei",
278+
# usedefault=True,
279+
desc="Extract brain measures for Thalamic Nuclei template",
280+
xor=["noROI"],
281+
)
282+
suit = traits.Bool(
283+
True,
284+
field="output.ROImenu.atlases.suit",
285+
# usedefault=True,
286+
desc="Extract brain measures for Suit template",
287+
xor=["noROI"],
288+
)
289+
ibsr = traits.Bool(
290+
False,
291+
field="output.ROImenu.atlases.ibsr",
292+
# usedefault=True,
293+
desc="Extract brain measures for IBSR template",
294+
xor=["noROI"],
261295
)
262296
own_atlas = InputMultiPath(
263297
ImageFileSPM(exists=True),
264298
field="output.ROImenu.atlases.ownatlas",
265299
desc="Extract brain measures for a given template",
266300
mandatory=False,
267301
copyfile=False,
302+
xor=["noROI"],
303+
)
304+
noROI = traits.Bool(
305+
field="output.ROImenu.noROI",
306+
desc="Select if no ROI analysis needed",
307+
xor=["neuromorphometrics", "lpba40", "cobra", "hammers", "thalamus", "thalamic_nuclei", "suit", "ibsr"],
268308
)
269309

270310
# Grey matter
@@ -524,13 +564,6 @@ def _format_arg(self, opt, spec, val):
524564
return scans_for_fname(val)
525565
elif opt in ["tpm", "shooting_tpm"]:
526566
return Cell2Str(val)
527-
528-
if opt == "surface_measures":
529-
if not self.inputs.surface_measures:
530-
self.inputs.neuromorphometrics = False
531-
self.inputs.lpba40 = False
532-
self.inputs.cobra = False
533-
self.inputs.hammers = False
534567

535568
return super()._format_arg(opt, spec, val)
536569

@@ -560,22 +593,22 @@ def _list_outputs(self):
560593

561594
if self.inputs.save_bias_corrected:
562595
outputs["bias_corrected_image"] = fname_presuffix(
563-
f, prefix=os.path.join("mri", "wmi")
596+
f, prefix=os.path.join("mri", "wm")
564597
)
565598

566-
outputs["surface_files"] = [
567-
str(surf) for surf in Path(pth).glob("surf/*") if surf.is_file()
568-
]
569-
570-
for hemisphere in ["rh", "lh"]:
571-
for suffix in ["central", "sphere"]:
572-
outfield = f"{hemisphere}_{suffix}_surface"
573-
outputs[outfield] = fname_presuffix(
574-
f,
575-
prefix=os.path.join("surf", f"{hemisphere}.{suffix}."),
576-
suffix=".gii",
577-
use_ext=False,
578-
)
599+
if self.inputs.surface_and_thickness_estimation:
600+
outputs["surface_files"] = [
601+
str(surf) for surf in Path(pth).glob("surf/*") if surf.is_file()
602+
]
603+
for hemisphere in ["rh", "lh"]:
604+
for suffix in ["central", "sphere"]:
605+
outfield = f"{hemisphere}_{suffix}_surface"
606+
outputs[outfield] = fname_presuffix(
607+
f,
608+
prefix=os.path.join("surf", f"{hemisphere}.{suffix}."),
609+
suffix=".gii",
610+
use_ext=False,
611+
)
579612

580613
outputs["report_files"] = outputs["report_files"] = [
581614
str(report) for report in Path(pth).glob("report/*") if report.is_file()
@@ -589,11 +622,10 @@ def _list_outputs(self):
589622
str(label) for label in Path(pth).glob("label/*") if label.is_file()
590623
]
591624

592-
if self.inputs.surface_measures:
625+
if self.inputs.noROI:
593626
outputs["label_rois"] = fname_presuffix(
594627
f, prefix=os.path.join("label", "catROIs_"), suffix=".xml", use_ext=False
595628
)
596-
else:
597629
outputs["label_roi"] = fname_presuffix(
598630
f, prefix=os.path.join("label", "catROI_"), suffix=".xml", use_ext=False
599631
)

0 commit comments

Comments
 (0)