Skip to content

Commit 511ea71

Browse files
Owedaeffigies
Oweda
authored andcommitted
FIX Issue nipy#3654: added missing input traits for templates, corrected if statements for when no surface or ROI estimations are desired
1 parent 37d3ac2 commit 511ea71

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
@@ -226,46 +226,86 @@ class CAT12SegmentInputSpec(SPMCommandInputSpec):
226226
" are not available as batch dependencies objects. "
227227
)
228228
surface_and_thickness_estimation = traits.Int(
229-
1, field="surface", desc=_help_surf, usedefault=True
229+
1, field="output.surface", desc=_help_surf, usedefault=True
230230
)
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"],
236238
)
237239

238240
# Templates
239241
neuromorphometrics = traits.Bool(
240242
True,
241243
field="output.ROImenu.atlases.neuromorphometrics",
242-
usedefault=True,
244+
# usedefault=True,
243245
desc="Extract brain measures for Neuromorphometrics template",
246+
xor=["noROI"],
244247
)
245248
lpba40 = traits.Bool(
246249
True,
247250
field="output.ROImenu.atlases.lpba40",
248-
usedefault=True,
251+
# usedefault=True,
249252
desc="Extract brain measures for LPBA40 template",
253+
xor=["noROI"],
250254
)
251255
cobra = traits.Bool(
252256
True,
253257
field="output.ROImenu.atlases.hammers",
254-
usedefault=True,
258+
# usedefault=True,
255259
desc="Extract brain measures for COBRA template",
260+
xor=["noROI"],
256261
)
257262
hammers = traits.Bool(
258-
True,
263+
False,
259264
field="output.ROImenu.atlases.cobra",
260-
usedefault=True,
265+
# usedefault=True,
261266
desc="Extract brain measures for Hammers template",
267+
xor=["noROI"],
268+
)
269+
thalamus = traits.Bool(
270+
True,
271+
field="output.ROImenu.atlases.thalamus",
272+
# usedefault=True,
273+
desc="Extract brain measures for Thalamus template",
274+
xor=["noROI"],
275+
)
276+
thalamic_nuclei = traits.Bool(
277+
True,
278+
field="output.ROImenu.atlases.thalamaic_nuclei",
279+
# usedefault=True,
280+
desc="Extract brain measures for Thalamic Nuclei template",
281+
xor=["noROI"],
282+
)
283+
suit = traits.Bool(
284+
True,
285+
field="output.ROImenu.atlases.suit",
286+
# usedefault=True,
287+
desc="Extract brain measures for Suit template",
288+
xor=["noROI"],
289+
)
290+
ibsr = traits.Bool(
291+
False,
292+
field="output.ROImenu.atlases.ibsr",
293+
# usedefault=True,
294+
desc="Extract brain measures for IBSR template",
295+
xor=["noROI"],
262296
)
263297
own_atlas = InputMultiPath(
264298
ImageFileSPM(exists=True),
265299
field="output.ROImenu.atlases.ownatlas",
266300
desc="Extract brain measures for a given template",
267301
mandatory=False,
268302
copyfile=False,
303+
xor=["noROI"],
304+
)
305+
noROI = traits.Bool(
306+
field="output.ROImenu.noROI",
307+
desc="Select if no ROI analysis needed",
308+
xor=["neuromorphometrics", "lpba40", "cobra", "hammers", "thalamus", "thalamic_nuclei", "suit", "ibsr"],
269309
)
270310

271311
# Grey matter
@@ -525,13 +565,6 @@ def _format_arg(self, opt, spec, val):
525565
return scans_for_fname(val)
526566
elif opt in ["tpm", "shooting_tpm"]:
527567
return Cell2Str(val)
528-
529-
if opt == "surface_measures":
530-
if not self.inputs.surface_measures:
531-
self.inputs.neuromorphometrics = False
532-
self.inputs.lpba40 = False
533-
self.inputs.cobra = False
534-
self.inputs.hammers = False
535568

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

@@ -561,22 +594,22 @@ def _list_outputs(self):
561594

562595
if self.inputs.save_bias_corrected:
563596
outputs["bias_corrected_image"] = fname_presuffix(
564-
f, prefix=os.path.join("mri", "wmi")
597+
f, prefix=os.path.join("mri", "wm")
565598
)
566599

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

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

593-
if self.inputs.surface_measures:
626+
if self.inputs.noROI:
594627
outputs["label_rois"] = fname_presuffix(
595628
f, prefix=os.path.join("label", "catROIs_"), suffix=".xml", use_ext=False
596629
)
597-
else:
598630
outputs["label_roi"] = fname_presuffix(
599631
f, prefix=os.path.join("label", "catROI_"), suffix=".xml", use_ext=False
600632
)

0 commit comments

Comments
 (0)