text stringlengths 1 93.6k |
|---|
# mrnp = (mrnp-minV)/(maxV-minV)
|
#for training data in pelvicSeg
|
if opt.how2normalize == 1:
|
maxV, minV = np.percentile(mrnp, [99 ,1])
|
print 'maxV,',maxV,' minV, ',minV
|
mrnp = (mrnp-mu)/(maxV-minV)
|
print 'unique value: ',np.unique(ctnp)
|
#for training data in pelvicSeg
|
if opt.how2normalize == 2:
|
maxV, minV = np.percentile(mrnp, [99 ,1])
|
print 'maxV,',maxV,' minV, ',minV
|
mrnp = (mrnp-mu)/(maxV-minV)
|
print 'unique value: ',np.unique(ctnp)
|
#for training data in pelvicSegRegH5
|
if opt.how2normalize== 3:
|
std = np.std(mrnp)
|
mrnp = (mrnp - mu)/std
|
print 'maxV,',np.ndarray.max(mrnp),' minV, ',np.ndarray.min(mrnp)
|
if opt.how2normalize == 4:
|
maxLPET = 149.366742
|
maxPercentLPET = 7.76
|
minLPET = 0.00055037
|
meanLPET = 0.27593288
|
stdLPET = 0.75747500
|
# for rsCT
|
maxCT = 27279
|
maxPercentCT = 1320
|
minCT = -1023
|
meanCT = -601.1929
|
stdCT = 475.034
|
# for s-pet
|
maxSPET = 156.675962
|
maxPercentSPET = 7.79
|
minSPET = 0.00055037
|
meanSPET = 0.284224789
|
stdSPET = 0.7642257
|
#matLPET = (mrnp - meanLPET) / (stdLPET)
|
matLPET = (mrnp - minLPET) / (maxPercentLPET - minLPET)
|
matCT = (ctnp - meanCT) / stdCT
|
matSPET = (hpetnp - minSPET) / (maxPercentSPET - minSPET)
|
if opt.how2normalize == 5:
|
# for rsCT
|
maxCT = 27279
|
maxPercentCT = 1320
|
minCT = -1023
|
meanCT = -601.1929
|
stdCT = 475.034
|
print
|
'ct, max: ', np.amax(ctnp), ' ct, min: ', np.amin(ctnp)
|
# matLPET = (mrnp - meanLPET) / (stdLPET)
|
matLPET = mrnp
|
matCT = (ctnp - meanCT) / stdCT
|
matSPET = hpetnp
|
if not opt.isMultiSource:
|
# matFA = matLPET
|
# matGT = matSPET
|
matFA = mrnp
|
matGT = hpetnp
|
print 'matFA shape: ',matFA.shape, ' matGT shape: ', matGT.shape
|
matOut = testOneSubject_aver_res(matFA,matGT,[16,64,64],[16,64,64],[8,32,32],net,opt.prefixModelName+'%d.pt'%iter, nd=3)
|
print 'matOut shape: ',matOut.shape
|
ct_estimated = matOut
|
itspsnr = psnr(ct_estimated, matGT)
|
print 'pred: ',ct_estimated.dtype, ' shape: ',ct_estimated.shape
|
print 'gt: ',ctnp.dtype,' shape: ',ct_estimated.shape
|
print 'psnr = ',itspsnr
|
volout = sitk.GetImageFromArray(ct_estimated)
|
volout.SetSpacing(spacing)
|
volout.SetOrigin(origin)
|
volout.SetDirection(direction)
|
sitk.WriteImage(volout,opt.prefixPredictedFN+'{}'.format(iter)+'.nii.gz')
|
else:
|
# matFA = matLPET
|
# matGT = matSPET
|
matFA = mrnp
|
matGT = hpetnp
|
print 'matFA shape: ', matFA.shape, ' matGT shape: ', matGT.shape
|
matOut = testOneSubject_aver_res_multiModal(matFA, matCT, matGT, [16, 64, 64], [16, 64, 64], [8, 32, 32], net,
|
opt.prefixModelName + '%d.pt' % iter)
|
print 'matOut shape: ', matOut.shape
|
ct_estimated = matOut
|
itspsnr = psnr(ct_estimated, matGT)
|
print 'pred: ', ct_estimated.dtype, ' shape: ', ct_estimated.shape
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.