Example #1
0
# T2dir = '/home/sci/blakez/M13_01/data/MRI/'
T2dir = '/home/sci/blakez/M15-01/Data/MRI/HARVEY_OSAMA_TOBLAKE/'
ex = 'Korenberg09_MonkeyBrain_Korenberg09_MonkeyBrain_081815_Live_Harv__E16_P1_2.16.756.5.5.100.1654368313.31476.1439925928.1/'
SaveDir = '/home/sci/blakez/M15-01/Results/MRI/invivo_MRI/081815_E16/'

memT = ca.MEM_DEVICE
write = False

# T2 = cc.LoadMHA(T2dir + 'T2Seg_roty-119_flipy.mha',memT)
T2 = cc.LoadMHA(T2dir + 'T2_MRI.mha', memT)
T2_mask = cc.LoadMHA(T2dir + '../M15_01_MRI_Full_Mask.mha', memT)
T2 *= T2_mask
# rotMat = np.load(T2dir + 'rotationMatrix.npy')
# live = cc.LoadMHA(livedir + 'M13_01_live_MRI.mha',memT)
live = cc.LoadMHA(livedir + 'M15_01_live_MRI_E16.mha', memT)
live_mask = cc.LoadNRRD(SaveDir + 'M15_01_live_MRI_mask.nrrd', memT)

live_mask.setOrigin(live.origin())
live -= ca.Min(live)
live /= ca.Max(live)
live *= live_mask

with open(SaveDir + 'M15_01_LiveE16-T2_Landmarks.json', 'r') as f:
    landmarks = json.load(f)

# live.setOrigin(ca.Vec3Df(-119.5,-59.5,-99.5))
# live.setSpacing(ca.Vec3Df(1,1,1))
T2Grid = T2.grid()

# Landmark pairs for the registration
# landmarks = [[[ 99.0, 50.0, 121.0] , [102.0,118.0,135.0]],  #good
Example #2
0
M15dir = os.path.expanduser(
    '~/korenbergNAS/3D_database/Working/MRI/Post-Mortem_MRI/Subject_to_Subject/M15/'
)

with open(M13dir + 'Affine/M13_01_MRI_affineLandmarks_affineApplied_3.txt',
          'r') as m13:
    m13pts = [[float(v) for v in line.split()] for line in m13]

with open(M15dir + 'Affine/M15_01_MRI_affineLandmarks_3.txt', 'r') as m15:
    m15pts = [[float(v) for v in line.split()] for line in m15]

aff_M13 = np.load(M13dir + 'Affine/rotationMatrix.npy')

M13_aff = cc.LoadMHA(M13dir + 'Affine/T2Seg_roty-119_flipy.mha', memT)
M15 = cc.LoadMHA(M15dir + 'Affine/T2_MRI.mha', memT)
M15_mask = cc.LoadNRRD(
    M15dir + 'Affine/M15_01_MRI_Full_Mask_lessBrainStem.nrrd', memT)
M13_mask = cc.LoadNRRD(
    M13dir + 'Affine/M13_01_MRI_Full_Mask_lessBrainStem.nrrd', memT)

M15_mask.setGrid(M15.grid())
M13_mask.setGrid(M13_aff.grid())

M15 *= M15_mask
M13_aff *= M13_mask

# Points in the M15 were chosen in Flipped Y coordiante system, so flip them back
# for pts in m15pts:
#     pts[0]= 256-pts[0]
#     pts[1]= 256-pts[1]

landmarks = [[m13pts[x], m15pts[x]] for x in range(0, np.shape(m13pts)[0])]