File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ class RegistrationRC(reporting.ReportCapableInterface):
5252 _fixed_image_label = "fixed"
5353 _moving_image_label = "moving"
5454 _contour = None
55+ _dismiss_affine = False
5556
5657 def _generate_report (self ):
5758 """Generate the visual report."""
@@ -96,6 +97,7 @@ def _generate_report(self):
9697 label = self ._fixed_image_label ,
9798 contour = contour_nii ,
9899 compress = self .inputs .compress_report ,
100+ dismiss_affine = self ._dismiss_affine ,
99101 ),
100102 plot_registration (
101103 moving_image_nii ,
@@ -105,6 +107,7 @@ def _generate_report(self):
105107 label = self ._moving_image_label ,
106108 contour = contour_nii ,
107109 compress = self .inputs .compress_report ,
110+ dismiss_affine = self ._dismiss_affine ,
108111 ),
109112 out_file = self ._out_report ,
110113 )
Original file line number Diff line number Diff line change @@ -351,6 +351,9 @@ class _SimpleBeforeAfterInputSpecRPT(nrb._SVGReportCapableInputSpec):
351351 wm_seg = File (desc = "reference white matter segmentation mask" )
352352 before_label = traits .Str ("before" , usedefault = True )
353353 after_label = traits .Str ("after" , usedefault = True )
354+ dismiss_affine = traits .Bool (
355+ False , usedefault = True , desc = "rotate image(s) to cardinal axes"
356+ )
354357
355358
356359class SimpleBeforeAfterRPT (nrb .RegistrationRC , nrb .ReportingInterface ):
@@ -363,6 +366,7 @@ def _post_run_hook(self, runtime):
363366 self ._fixed_image = self .inputs .after
364367 self ._moving_image = self .inputs .before
365368 self ._contour = self .inputs .wm_seg if isdefined (self .inputs .wm_seg ) else None
369+ self ._dismiss_affine = self .inputs .dismiss_affine
366370 NIWORKFLOWS_LOG .info (
367371 "Report - setting before (%s) and after (%s) images" ,
368372 self ._fixed_image ,
Original file line number Diff line number Diff line change @@ -324,6 +324,7 @@ def plot_registration(
324324 label = None ,
325325 contour = None ,
326326 compress = "auto" ,
327+ dismiss_affine = False ,
327328):
328329 """
329330 Plots the foreground and background views
@@ -351,6 +352,15 @@ def plot_registration(
351352 white = nlimage .new_img_like (contour , contour_data == 2 )
352353 pial = nlimage .new_img_like (contour , contour_data >= 2 )
353354
355+ if dismiss_affine :
356+ canonical_r = rotation2canonical (anat_nii )
357+ anat_nii = rotate_affine (anat_nii , rot = canonical_r )
358+ if ribbon :
359+ white = rotate_affine (white , rot = canonical_r )
360+ pial = rotate_affine (pial , rot = canonical_r )
361+ if contour :
362+ contour = rotate_affine (contour , rot = canonical_r )
363+
354364 # Plot each cut axis
355365 for i , mode in enumerate (list (order )):
356366 plot_params ["display_mode" ] = mode
You can’t perform that action at this time.
0 commit comments