@@ -1237,6 +1237,108 @@ class To3D(AFNICommand):
12371237 output_spec = AFNICommandOutputSpec
12381238
12391239
1240+ class UnifizeInputSpec (AFNICommandInputSpec ):
1241+ in_file = File (
1242+ desc = 'input file to 3dUnifize' ,
1243+ argstr = '-input %s' ,
1244+ position = - 1 ,
1245+ mandatory = True ,
1246+ exists = True ,
1247+ copyfile = False )
1248+ out_file = File (
1249+ desc = 'output image file name' ,
1250+ argstr = '-prefix %s' )
1251+ t2 = traits .Bool (
1252+ desc = 'Treat the input as if it were T2-weighted, rather than '
1253+ 'T1-weighted. This processing is done simply by inverting '
1254+ 'the image contrast, processing it as if that result were '
1255+ 'T1-weighted, and then re-inverting the results '
1256+ 'counts of voxel overlap, i.e., each voxel will contain the '
1257+ 'number of masks that it is set in.' ,
1258+ argstr = '-T2' )
1259+ gm = traits .Bool (
1260+ desc = 'Also scale to unifize \' gray matter\' = lower intensity voxels '
1261+ '(to aid in registering images from different scanners).' ,
1262+ argstr = '-GM' )
1263+ urad = traits .Float (
1264+ desc = 'Sets the radius (in voxels) of the ball used for the sneaky '
1265+ 'trick. Default value is 18.3, and should be changed '
1266+ 'proportionally if the dataset voxel size differs significantly '
1267+ 'from 1 mm.' ,
1268+ argstr = '-Urad %s' )
1269+ scale_file = File (
1270+ desc = 'output file name to save the scale factor used at each voxel ' ,
1271+ argstr = '-ssave %s' )
1272+ no_duplo = traits .Bool (
1273+ desc = 'Do NOT use the \' duplo down\' step; this can be useful for '
1274+ 'lower resolution datasets.' ,
1275+ argstr = '-noduplo' )
1276+ epi = traits .Bool (
1277+ desc = 'Assume the input dataset is a T2 (or T2*) weighted EPI time '
1278+ 'series. After computing the scaling, apply it to ALL volumes '
1279+ '(TRs) in the input dataset. That is, a given voxel will be '
1280+ 'scaled by the same factor at each TR. '
1281+ 'This option also implies \' -noduplo\' and \' -T2\' .'
1282+ 'This option turns off \' -GM\' if you turned it on.' ,
1283+ argstr = '-EPI' ,
1284+ requires = ['no_duplo' , 't2' ],
1285+ xor = ['gm' ])
1286+
1287+
1288+ class UnifizeOutputSpec (TraitedSpec ):
1289+ scale_file = File (desc = 'scale factor file' )
1290+ out_file = File (desc = 'unifized file' , exists = True )
1291+
1292+
1293+ class Unifize (AFNICommand ):
1294+ """3dUnifize - for uniformizing image intensity
1295+
1296+ * The input dataset is supposed to be a T1-weighted volume,
1297+ possibly already skull-stripped (e.g., via 3dSkullStrip).
1298+ However, this program can be a useful step to take BEFORE
1299+ 3dSkullStrip, since the latter program can fail if the input
1300+ volume is strongly shaded -- 3dUnifize will (mostly) remove
1301+ such shading artifacts.
1302+
1303+ * The output dataset has the white matter (WM) intensity approximately
1304+ uniformized across space, and scaled to peak at about 1000.
1305+
1306+ * The output dataset is always stored in float format!
1307+
1308+ * If the input dataset has more than 1 sub-brick, only sub-brick
1309+ #0 will be processed!
1310+
1311+ * Want to correct EPI datasets for nonuniformity?
1312+ You can try the new and experimental [Mar 2017] '-EPI' option.
1313+
1314+ * The principal motive for this program is for use in an image
1315+ registration script, and it may or may not be useful otherwise.
1316+
1317+ * This program replaces the older (and very different) 3dUniformize,
1318+ which is no longer maintained and may sublimate at any moment.
1319+ (In other words, we do not recommend the use of 3dUniformize.)
1320+
1321+ For complete details, see the `3dUnifize Documentation.
1322+ <https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dUnifize.html>`_
1323+
1324+ Examples
1325+ ========
1326+
1327+ >>> from nipype.interfaces import afni
1328+ >>> unifize = afni.Unifize()
1329+ >>> unifize.inputs.in_file = 'structural.nii'
1330+ >>> unifize.inputs.out_file = 'structural_unifized.nii'
1331+ >>> unifize.cmdline # doctest: +ALLOW_UNICODE
1332+ '3dUnifize -prefix structural_unifized.nii -input structural.nii'
1333+ >>> res = unifize.run() # doctest: +SKIP
1334+
1335+ """
1336+
1337+ _cmd = '3dUnifize'
1338+ input_spec = UnifizeInputSpec
1339+ output_spec = UnifizeOutputSpec
1340+
1341+
12401342class ZCutUpInputSpec (AFNICommandInputSpec ):
12411343 in_file = File (
12421344 desc = 'input file to 3dZcutup' ,
0 commit comments