1616import numpy as np
1717from nibabel import load
1818
19+ from ... import LooseVersion
1920from ...utils .filemanip import split_filename
2021from ..base import (TraitedSpec , File , InputMultiPath , OutputMultiPath ,
2122 Undefined , traits , isdefined )
@@ -826,10 +827,17 @@ def _list_outputs(self):
826827 output_dir = os .path .dirname (outputs ['out_file' ])
827828
828829 if isdefined (self .inputs .stats_imgs ) and self .inputs .stats_imgs :
829- outputs ['variance_img' ] = self ._gen_fname (
830- outputs ['out_file' ] + '_variance.ext' , cwd = output_dir )
831- outputs ['std_img' ] = self ._gen_fname (
832- outputs ['out_file' ] + '_sigma.ext' , cwd = output_dir )
830+ if LooseVersion (Info .version ()) < LooseVersion ('6.0.0' ):
831+ # FSL <6.0 outputs have .nii.gz_variance.nii.gz as extension
832+ outputs ['variance_img' ] = self ._gen_fname (
833+ outputs ['out_file' ] + '_variance.ext' , cwd = output_dir )
834+ outputs ['std_img' ] = self ._gen_fname (
835+ outputs ['out_file' ] + '_sigma.ext' , cwd = output_dir )
836+ else :
837+ outputs ['variance_img' ] = self ._gen_fname (
838+ outputs ['out_file' ], suffix = '_variance' , cwd = output_dir )
839+ outputs ['std_img' ] = self ._gen_fname (
840+ outputs ['out_file' ], suffix = '_sigma' , cwd = output_dir )
833841
834842 # The mean image created if -stats option is specified ('meanvol')
835843 # is missing the top and bottom slices. Therefore we only expose the
@@ -838,8 +846,13 @@ def _list_outputs(self):
838846 # Note that the same problem holds for the std and variance image.
839847
840848 if isdefined (self .inputs .mean_vol ) and self .inputs .mean_vol :
841- outputs ['mean_img' ] = self ._gen_fname (
842- outputs ['out_file' ] + '_mean_reg.ext' , cwd = output_dir )
849+ if LooseVersion (Info .version ()) < LooseVersion ('6.0.0' ):
850+ # FSL <6.0 outputs have .nii.gz_mean_img.nii.gz as extension
851+ outputs ['mean_img' ] = self ._gen_fname (
852+ outputs ['out_file' ] + '_mean_reg.ext' , cwd = output_dir )
853+ else :
854+ outputs ['mean_img' ] = self ._gen_fname (
855+ outputs ['out_file' ], suffix = '_mean_reg' , cwd = output_dir )
843856
844857 if isdefined (self .inputs .save_mats ) and self .inputs .save_mats :
845858 _ , filename = os .path .split (outputs ['out_file' ])
0 commit comments