@@ -737,6 +737,7 @@ def _conditional_downsampling(in_file, in_mask, zoom_th=4.0):
737
737
import nibabel as nb
738
738
import nitransforms as nt
739
739
import numpy as np
740
+ from nitransforms .resampling import apply as transform
740
741
from scipy .ndimage .filters import gaussian_filter
741
742
742
743
img = nb .load (in_file )
@@ -756,14 +757,16 @@ def _conditional_downsampling(in_file, in_mask, zoom_th=4.0):
756
757
offset = old_center - newrot .dot ((newshape - 1 ) * 0.5 )
757
758
newaffine = nb .affines .from_matvec (newrot , offset )
758
759
760
+ identity = nt .base .TransformBase ()
761
+
759
762
newref = nb .Nifti1Image (np .zeros (newshape , dtype = np .uint8 ), newaffine )
760
- nt . Affine ( reference = newref ). apply ( img ).to_filename (out_file )
763
+ transform ( identity , img , reference = newref ).to_filename (out_file )
761
764
762
765
mask = nb .load (in_mask )
763
766
mask .set_data_dtype (float )
764
767
mdata = gaussian_filter (mask .get_fdata (dtype = float ), scaling )
765
768
floatmask = nb .Nifti1Image (mdata , mask .affine , mask .header )
766
- newmask = nt . Affine ( reference = newref ). apply ( floatmask )
769
+ newmask = transform ( identity , floatmask , reference = newref )
767
770
hdr = newmask .header .copy ()
768
771
hdr .set_data_dtype (np .uint8 )
769
772
newmaskdata = (newmask .get_fdata (dtype = float ) > 0.5 ).astype (np .uint8 )
0 commit comments