@@ -399,12 +399,16 @@ def _make_matlab_command(self, _):
399
399
for c0 , cond in enumerate (contrast .conditions ):
400
400
script += ("idx = strmatch('%s',condnames,'exact');\n "
401
401
% (cond ))
402
- script += "if isempty(idx), throw(MException('CondName:Chk', sprintf('Condition %%s not found in design','%s'))); end;\n " % cond
402
+ script += (("if isempty(idx), throw(MException("
403
+ "'CondName:Chk', sprintf('Condition %%s not "
404
+ "found in design','%s'))); end;\n " ) % cond )
403
405
if contrast .sessions :
404
406
for sno , sw in enumerate (contrast .sessions ):
405
407
script += ("sidx = find(condsess(idx)==%d);\n "
406
408
% (sno + 1 ))
407
- script += "consess{%d}.tcon.convec(idx(sidx)) = %f;\n " % (i + 1 , sw * contrast .weights [c0 ])
409
+ script += (("consess{%d}.tcon.convec(idx(sidx)) "
410
+ "= %f;\n " )
411
+ % (i + 1 , sw * contrast .weights [c0 ]))
408
412
else :
409
413
script += ("consess{%d}.tcon.convec(idx) = %f;\n "
410
414
% (i + 1 , contrast .weights [c0 ]))
@@ -419,7 +423,9 @@ def _make_matlab_command(self, _):
419
423
Exception ("Contrast Estimate: could not get index of"
420
424
" T contrast. probably not defined prior "
421
425
"to the F contrasts" )
422
- script += "consess{%d}.fcon.convec{%d} = consess{%d}.tcon.convec;\n " % (i + 1 , cl0 + 1 , tidx + 1 )
426
+ script += (("consess{%d}.fcon.convec{%d} = "
427
+ "consess{%d}.tcon.convec;\n " )
428
+ % (i + 1 , cl0 + 1 , tidx + 1 ))
423
429
script += "jobs{1}.stats{1}.con.consess = consess;\n "
424
430
script += ("if strcmp(spm('ver'),'SPM8'), spm_jobman('initcfg');"
425
431
"jobs=spm_jobman('spm5tospm8',{jobs});end\n " )
@@ -578,7 +584,9 @@ def _make_matlab_command(self, _):
578
584
Zth = Z(Z >= cluster_forming_thr);
579
585
580
586
"""
581
- script += "spm_write_filtered(Zth,XYZth,stat_map_vol.dim',stat_map_vol.mat,'thresholded map', '%s');\n " % self ._gen_pre_topo_map_filename ()
587
+ script += (("spm_write_filtered(Zth,XYZth,stat_map_vol.dim',"
588
+ "stat_map_vol.mat,'thresholded map', '%s');\n " )
589
+ % self ._gen_pre_topo_map_filename ())
582
590
script += """
583
591
max_size = 0;
584
592
max_size_index = 0;
@@ -590,7 +598,8 @@ def _make_matlab_command(self, _):
590
598
else
591
599
if use_topo_fdr
592
600
V2R = 1/prod(FWHM(stat_map_vol.dim > 1));
593
- [uc,Pc,ue] = spm_uc_clusterFDR(cluster_extent_p_fdr_thr,df,STAT,R,n,Z,XYZ,V2R,cluster_forming_thr);
601
+ [uc,Pc,ue] = spm_uc_clusterFDR(cluster_extent_p_fdr_thr,df,\
602
+ STAT,R,n,Z,XYZ,V2R,cluster_forming_thr);
594
603
end
595
604
596
605
voxel_labels = spm_clusters(XYZth);
@@ -601,8 +610,10 @@ def _make_matlab_command(self, _):
601
610
602
611
for i = 1:nclusters
603
612
cluster_size = sum(voxel_labels==i);
604
- if cluster_size > extent_threshold && (~use_topo_fdr || (cluster_size - uc) > -1)
605
- thresholded_XYZ = cat(2, thresholded_XYZ, XYZth(:,voxel_labels == i));
613
+ if cluster_size > extent_threshold && (~use_topo_fdr || \
614
+ (cluster_size - uc) > -1)
615
+ thresholded_XYZ = cat(2, thresholded_XYZ, \
616
+ XYZth(:,voxel_labels == i));
606
617
thresholded_Z = cat(2, thresholded_Z, Zth(voxel_labels == i));
607
618
th_nclusters = th_nclusters + 1;
608
619
end
@@ -636,13 +647,16 @@ def _make_matlab_command(self, _):
636
647
fprintf('cluster_forming_thr = %f\\ n',cluster_forming_thr);
637
648
638
649
"""
639
- script += "spm_write_filtered(thresholded_Z,thresholded_XYZ,stat_map_vol.dim',stat_map_vol.mat,'thresholded map', '%s');\n " % self ._gen_thresholded_map_filename ()
650
+ script += (("spm_write_filtered(thresholded_Z,thresholded_XYZ,"
651
+ "stat_map_vol.dim',stat_map_vol.mat,'thresholded map',"
652
+ " '%s');\n " ) % self ._gen_thresholded_map_filename ())
640
653
641
654
return script
642
655
643
656
def aggregate_outputs (self , runtime = None ):
644
657
outputs = self ._outputs ()
645
- setattr (outputs , 'thresholded_map' , self ._gen_thresholded_map_filename ())
658
+ setattr (outputs , 'thresholded_map' ,
659
+ self ._gen_thresholded_map_filename ())
646
660
setattr (outputs , 'pre_topo_fdr_map' , self ._gen_pre_topo_map_filename ())
647
661
for line in runtime .stdout .split ('\n ' ):
648
662
if line .startswith ("activation_forced = " ):
@@ -735,7 +749,8 @@ def _make_matlab_command(self, _):
735
749
voxelwise_P_uncor = (1-spm_Ncdf(cluster_forming_thr)).^n
736
750
case 'T'
737
751
VPs = (1 - spm_Tcdf(Zum,df(2))).^n;
738
- voxelwise_P_uncor = (1 - spm_Tcdf(cluster_forming_thr,df(2))).^n
752
+ voxelwise_P_uncor = \
753
+ (1 - spm_Tcdf(cluster_forming_thr,df(2))).^n
739
754
case 'X'
740
755
VPs = (1-spm_Xcdf(Zum,df(2))).^n;
741
756
voxelwise_P_uncor = (1-spm_Xcdf(cluster_forming_thr,df(2))).^n
@@ -749,14 +764,17 @@ def _make_matlab_command(self, _):
749
764
750
765
V2R = 1/prod(FWHM(stat_map_vol.dim > 1));
751
766
752
- clusterwise_P_RF = spm_P_RF(1,extent_threshold*V2R,cluster_forming_thr,df,STAT,R,n)
767
+ clusterwise_P_RF = \
768
+ spm_P_RF(1,extent_threshold*V2R,cluster_forming_thr,df,STAT,R,n)
753
769
754
770
[x,y,z] = ind2sub(size(stat_map_data),(1:numel(stat_map_data))');
755
771
XYZ = cat(1, x', y', z');
756
772
757
- [u, CPs, ue] = spm_uc_clusterFDR(0.05,df,STAT,R,n,Z,XYZ,V2R,cluster_forming_thr);
773
+ [u, CPs, ue] = \
774
+ spm_uc_clusterFDR(0.05,df,STAT,R,n,Z,XYZ,V2R,cluster_forming_thr);
758
775
759
- clusterwise_P_FDR = spm_P_clusterFDR(extent_threshold*V2R,df,STAT,R,n,cluster_forming_thr,CPs')
776
+ clusterwise_P_FDR = \
777
+ spm_P_clusterFDR(extent_threshold*V2R,df,STAT,R,n,cluster_forming_thr,CPs')
760
778
"""
761
779
return script
762
780
@@ -962,7 +980,8 @@ class PairedTTestDesign(FactorialDesign):
962
980
--------
963
981
964
982
>>> pttest = PairedTTestDesign()
965
- >>> pttest.inputs.paired_files = [['cont1.nii','cont1a.nii'],['cont2.nii','cont2a.nii']]
983
+ >>> pttest.inputs.paired_files = [['cont1.nii','cont1a.nii'],\
984
+ ['cont2.nii','cont2a.nii']]
966
985
>>> pttest.run() # doctest: +SKIP
967
986
"""
968
987
0 commit comments