@@ -291,52 +291,6 @@ def _run_interface(self, runtime):
291
291
return runtime
292
292
293
293
294
- class ReorientInputSpec (BaseInterfaceInputSpec ):
295
- in_file = File (exists = True , mandatory = True ,
296
- desc = 'Input T1w image' )
297
-
298
-
299
- class ReorientOutputSpec (TraitedSpec ):
300
- out_file = File (exists = True , desc = 'Reoriented T1w image' )
301
- transform = File (exists = True , desc = 'Reorientation transform' )
302
-
303
-
304
- class Reorient (SimpleInterface ):
305
- """Reorient a T1w image to RAS (left-right, posterior-anterior, inferior-superior)
306
-
307
- Syncs qform and sform codes for consistent treatment by all software
308
- """
309
- input_spec = ReorientInputSpec
310
- output_spec = ReorientOutputSpec
311
-
312
- def _run_interface (self , runtime ):
313
- # Load image, orient as RAS
314
- fname = self .inputs .in_file
315
- orig_img = nb .load (fname )
316
- reoriented = nb .as_closest_canonical (orig_img )
317
-
318
- # Reconstruct transform from orig to reoriented image
319
- ornt_xfm = nb .orientations .inv_ornt_aff (
320
- nb .io_orientation (orig_img .affine ), orig_img .shape )
321
-
322
- normalized = normalize_xform (reoriented )
323
-
324
- # Image may be reoriented
325
- if normalized is not orig_img :
326
- out_name = fname_presuffix (fname , suffix = '_ras' , newpath = runtime .cwd )
327
- normalized .to_filename (out_name )
328
- else :
329
- out_name = fname
330
-
331
- mat_name = fname_presuffix (fname , suffix = '.mat' , newpath = runtime .cwd , use_ext = False )
332
- np .savetxt (mat_name , ornt_xfm , fmt = '%.08f' )
333
-
334
- self ._results ['out_file' ] = out_name
335
- self ._results ['transform' ] = mat_name
336
-
337
- return runtime
338
-
339
-
340
294
class ValidateImageInputSpec (BaseInterfaceInputSpec ):
341
295
in_file = File (exists = True , mandatory = True , desc = 'input image' )
342
296
0 commit comments