Exemplo n.º 1
0
powers_areal_mni_itk = pd.read_csv(ants.get_data('powers_mni_itk'))
rdir = "../"
id = '2001'
t1fn = rdir + 'data/LS' + id + "/unprocessed/3T/T1w_MPR1/LS"+id+"_3T_T1w_MPR1_gdc.nii.gz"
# now the bold data
boldfnsL = rdir + "data/LS2001/LS2001fmri/unprocessed/3T/rfMRI_REST1_LR/LS2001_3T_rfMRI_REST1_LR_gdc.nii.gz"
boldfnsR = rdir + "data/LS2001/LS2001fmri/unprocessed/3T/rfMRI_REST1_RL/LS2001_3T_rfMRI_REST1_RL_gdc.nii.gz"
# get the ref data
reffns1 = rdir + 'data/LS2001/LS2001fmri/unprocessed/3T/rfMRI_REST1_LR/LS2001_3T_rfMRI_REST1_LR_SBRef_gdc.nii.gz'
reffns2 = rdir + 'data/LS2001/LS2001fmri/unprocessed/3T/rfMRI_REST1_RL/LS2001_3T_rfMRI_REST1_RL_SBRef_gdc.nii.gz'

##  Distortion correction (without a field map)

i1 = ants.image_read( reffns1 )
i2 = ants.image_read( reffns2 )
und = ants.build_template( i1, ( i1, i2 ), 3, gradient_step = 0.5 )
t1 = ants.image_read( t1fn ).n3_bias_field_correction( 8 ).n3_bias_field_correction( 4 )
bmask = ants.get_mask( und, low_thresh = und.mean() * 0.75, high_thresh=1e9, cleanup = 3 ).iMath_fill_holes()
# ants.plot( und, bmask, axis=2, overlay_alpha = 0.33 )
# this is a fragile approach - not really recommended - but it is quick
t1mask = ants.get_mask( t1, low_thresh = t1.mean() * 1.1, high_thresh=1e9, cleanup = 5 ).iMath_fill_holes()
# ants.plot( t1, t1mask, axis=2, overlay_alpha = 0.33 )
t1rig = ants.registration( und * bmask, t1 * t1mask, "BOLDRigid" )
t1reg = ants.registration( und * bmask, t1 * t1mask, "SyNOnly",
  initialTransform = t1rig['fwdtransforms'],
  synMetric = 'CC', synSampling = 2, regIterations = (5) )
###########################


# The distortion to the T1 is greatly reduced.
Exemplo n.º 2
0
import ants
import os
import glob

dataDirectory = './'
populationFiles = glob.glob(dataDirectory + "OASIS*Slice121.nii.gz")

population = list()
for i in range(len(populationFiles)):
    population.append(ants.image_read(populationFiles[i], dimension=2))

btp = ants.build_template(initialTemplate=None,
                          image_list=population,
                          iterations=4,
                          gradient_step=0.2,
                          verbose=True,
                          syn_metric='CC',
                          reg_iterations=(100, 70, 50, 0))

ants.plot(btp)
Exemplo n.º 3
0
 def test_type_of_transform(self):
     image = ants.image_read(ants.get_ants_data("r16"))
     image2 = ants.image_read(ants.get_ants_data("r27"))
     timage = ants.build_template(image_list=(image, image2))
     timage = ants.build_template(image_list=(image, image2),
                                  type_of_transform="SyNCC")
Exemplo n.º 4
0
 def test_example(self):
     image = ants.image_read(ants.get_ants_data("r16"))
     image2 = ants.image_read(ants.get_ants_data("r27"))
     timage = ants.build_template(image_list=(image, image2))
import ants
import os
import glob

dataDirectory = './'
populationFiles = glob.glob( dataDirectory + "OASIS*Slice121.nii.gz" )

population = list()
for i in range( len( populationFiles ) ):
  population.append( ants.image_read( populationFiles[i], dimension = 2 ) )

btp = ants.build_template( initialTemplate = None,
  image_list = population,
  iterations = 4,
  gradient_step = 0.2,
  verbose = True,
  syn_metric = 'CC',
  reg_iterations = ( 100, 70, 50, 0 ) )

ants.plot( btp )
Exemplo n.º 6
0
 def test_type_of_transform(self):
     image = ants.image_read(ants.get_ants_data('r16'))
     image2 = ants.image_read(ants.get_ants_data('r27'))
     timage = ants.build_template(image_list=(image, image2))
     timage = ants.build_template(image_list=(image, image2),
                                  type_of_transform='SyNCC')