@@ -123,9 +123,8 @@ class RealignInputSpec(SPMCommandInputSpec):
123123 desc = 'gaussian smoothing kernel width' )
124124 separation = traits .Range (low = 0.0 , field = 'eoptions.sep' ,
125125 desc = 'sampling separation in mm' )
126- register_to_mean = traits .Bool (True , field = 'eoptions.rtm' ,
127- mandatory = True , usedefault = True ,
128- desc = 'Indicate whether realignment is done to the mean image' )
126+ register_to_mean = traits .Bool (field = 'eoptions.rtm' ,
127+ desc = 'Indicate whether realignment is done to the mean image' )
129128 weight_img = File (exists = True , field = 'eoptions.weight' ,
130129 desc = 'filename of weighting image' )
131130 interp = traits .Range (low = 0 , high = 7 , field = 'eoptions.interp' ,
@@ -191,9 +190,13 @@ def _format_arg(self, opt, spec, val):
191190 """Convert input to appropriate format for spm
192191 """
193192 if opt == 'in_files' :
193+ if self .inputs .jobtype == "write" :
194+ separate_sessions = False
195+ else :
196+ separate_sessions = True
194197 return scans_for_fnames (val ,
195- keep4d = True ,
196- separate_sessions = True )
198+ keep4d = False ,
199+ separate_sessions = separate_sessions )
197200 return super (Realign , self )._format_arg (opt , spec , val )
198201
199202 def _parse_inputs (self ):
@@ -206,19 +209,21 @@ def _list_outputs(self):
206209 outputs = self ._outputs ().get ()
207210 resliced_all = self .inputs .write_which [0 ] > 0
208211 resliced_mean = self .inputs .write_which [1 ] > 0
209- if isdefined (self .inputs .in_files ):
210- outputs ['realignment_parameters' ] = []
211- for imgf in self .inputs .in_files :
212- if isinstance (imgf , list ):
213- tmp_imgf = imgf [0 ]
214- else :
215- tmp_imgf = imgf
216- outputs ['realignment_parameters' ].append (fname_presuffix (tmp_imgf ,
217- prefix = 'rp_' ,
218- suffix = '.txt' ,
219- use_ext = False ))
220- if not isinstance (imgf , list ) and func_is_3d (imgf ):
221- break
212+
213+ if self .inputs .jobtype != "write" :
214+ if isdefined (self .inputs .in_files ):
215+ outputs ['realignment_parameters' ] = []
216+ for imgf in self .inputs .in_files :
217+ if isinstance (imgf , list ):
218+ tmp_imgf = imgf [0 ]
219+ else :
220+ tmp_imgf = imgf
221+ outputs ['realignment_parameters' ].append (fname_presuffix (tmp_imgf ,
222+ prefix = 'rp_' ,
223+ suffix = '.txt' ,
224+ use_ext = False ))
225+ if not isinstance (imgf , list ) and func_is_3d (imgf ):
226+ break
222227 if self .inputs .jobtype == "estimate" :
223228 outputs ['realigned_files' ] = self .inputs .in_files
224229 if self .inputs .jobtype == "estimate" or self .inputs .jobtype == "estwrite" :
0 commit comments