コード例 #1
0
    sys.exit()
#Establish paths

BASE_PATH, RFD_NAME = os.path.split(os.path.abspath(sys.argv[1]))
print "\nProcessing file named: " + RFD_NAME + "\non path: " + BASE_PATH + "\n"
RESULT_DIR = BASE_PATH +'/' + RFD_NAME[:-4] + 'Results'
if os.path.isdir(RESULT_DIR):
    print "\nError, data set already processed."
    print "Directory: " + RESULT_DIR + " Exists. \n"
    sys.exit()

os.makedirs(RESULT_DIR)
os.makedirs(RESULT_DIR + '/blockMatch')
#Perform block-matching
from blockMatch import blockMatchClass
bl = blockMatchClass(BASE_PATH +'/'+ RFD_NAME, 'rfd', selectRoi = True)
for frameNo in range(bl.nFrames - 1 - MAX_SKIP):
    for skipNo in range(MAX_SKIP):

        bl.CreateStrainImage(preFrame = frameNo, skipFrame = skipNo, itkFileName = RESULT_DIR + '/blockMatch/frame_' + str(frameNo) +'_'
        + str(frameNo + 1 + skipNo) , vMax = STRAIN_THRESHOLD )

#After block-matching I compute the frame triplets with the optimum DQM
import numpy
from numpy import zeros
import SimpleITK as sitk
import cv
from scipy.interpolate import interp1d, RectBivariateSpline
from interp2NoSplines import interp2
DQM = zeros( bl.nFrames )
framePairs = zeros( (bl.nFrames, 2) )
コード例 #2
0
from rfData import rfClass
rf = rfClass(RFD_NAME, 'rfd')

os.mkdir(BASE_DIR)

#B-mode images
os.mkdir(BASE_DIR + '/Bmode')
for frame in range(rf.nFrames):

    rf.SaveBModeImages( BASE_DIR + '/Bmode/f' + str(frame).zfill(3) , frame)    

#use M-player to create a movie
os.chdir(BASE_DIR + '/Bmode')
os.system('mencoder "mf://*.png" -mf fps=4 -o ../bMode.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=1600')
os.chdir(START_DIR)

#Create ITK strain images
os.mkdir(BASE_DIR + '/strain')
from blockMatch import blockMatchClass
bl = blockMatchClass(RFD_NAME, 'rfd')
bl.WriteParameterFile(BASE_DIR +  '/blockMatchParams.txt' )

for frame in range(rf.nFrames - 1):
    bl.CreateStrainImage(preFrame = frame,pngFileName = BASE_DIR + '/strain/frame' + str(frame).zfill(3) + '.png' , itkFileName =
    BASE_DIR + '/strain/frame' + str(frame).zfill(3), vMax = .010)

#use M-player to create a movie
os.chdir(BASE_DIR +'/strain')
os.system('mencoder "mf://*.png" -mf fps=4 -o ../strain.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=1600')
os.chdir(START_DIR)
コード例 #3
0
    sys.exit()

#Establish paths'''
BASE_PATH, RFD_NAME = os.path.split(os.path.abspath(sys.argv[1]))
print "\nProcessing file named: " + RFD_NAME + "\non path: " + BASE_PATH + "\n"
RESULT_DIR = BASE_PATH + '/' + RFD_NAME[:-4] + 'Results'
if os.path.isdir(RESULT_DIR):
    print "\nError, data set already processed."
    print "Directory: " + RESULT_DIR + " Exists. \n"
    sys.exit()

os.makedirs(RESULT_DIR)
os.makedirs(RESULT_DIR + '/blockMatch')
#Perform block-matching
from blockMatch import blockMatchClass
bl = blockMatchClass(BASE_PATH + '/' + RFD_NAME, 'multiFocus', selectRoi=True)

for frameNo in range(bl.nFrames - 1 - 4):
    for skipNo in range(5):

        bl.CreateStrainImage(preFrame=frameNo,
                             skipFrame=skipNo,
                             itkFileName=RESULT_DIR + '/blockMatch/frame_' +
                             str(frameNo) + '_' + str(frameNo + 1 + skipNo),
                             vMax=STRAIN_THRESHOLD)

#After block-matching I compute the frame triplets with the optimum DQM
import numpy
from numpy import zeros
import SimpleITK as sitk
import cv
コード例 #4
0
if len(argv) < 3:
    print "Error in usage.  Correct usage: "
    print os.path.basename(argv[0]) + " rfdFile1 rfdFile2 pngFile <maxStrain>"

if len(argv) > 4:
    vMax = float( argv[4] )

else:
    vMax = .02

if '.png' not in argv[3]:
    picFName = argv[3] + '.png'
else:
    picFName = argv[3]

bl = blockMatchClass(argv[1],'rfd',postFile = argv[2])#, selectRoi = True)
bl.CreateStrainImage(pngFileName=picFName, vMax = vMax)

bl.DisplayScanConvertedStrainImage(vMax)

answer = None
while answer is not 'Y' and answer is not 'N':
    answer = raw_input('Is the plotting scale satisfactory? (Y or N)?\n')

if answer is 'Y':
    satisfiedWithScale = True
else:
    satisfiedWithScale = False

while not satisfiedWithScale:
    newMax = float( raw_input('Enter a new maximum strain value to display\n') )
コード例 #5
0
    print "RFD_NAME passed is not a regular file.(Potential RFD file) \n"
    sys.exit()
#Establish paths'''
BASE_PATH, RFD_NAME = os.path.split(os.path.abspath(sys.argv[1]))
print "\nProcessing file named: " + RFD_NAME + "\non path: " + BASE_PATH + "\n"
RESULT_DIR = BASE_PATH + '/' + RFD_NAME[:-4] + 'Results'
if os.path.isdir(RESULT_DIR):
    print "\nError, data set already processed."
    print "Directory: " + RESULT_DIR + " Exists. \n"
    sys.exit()

os.makedirs(RESULT_DIR)
os.makedirs(RESULT_DIR + '/blockMatch')
#Perform block-matching
from blockMatch import blockMatchClass
bl = blockMatchClass(BASE_PATH + '/' + RFD_NAME, 'rfd', selectRoi=True)
bl.nFrames = 62
for frameNo in range(bl.nFrames - 1 - 4):
    for skipNo in range(5):

        bl.CreateStrainImage(preFrame=frameNo,
                             skipFrame=skipNo,
                             itkFileName=RESULT_DIR + '/blockMatch/frame_' +
                             str(frameNo) + '_' + str(frameNo + 1 + skipNo),
                             vMax=STRAIN_THRESHOLD)

#After block-matching I compute the frame triplets with the optimum DQM
import numpy
from numpy import zeros
import SimpleITK as sitk
import cv
コード例 #6
0
if len(argv) < 3:
    print "Error in usage.  Correct usage: "
    print os.path.basename(argv[0]) + " rfdFile1 rfdFile2 pngFile <maxStrain>"

if len(argv) > 4:
    vMax = float(argv[4])

else:
    vMax = 0.02

if ".png" not in argv[3]:
    picFName = argv[3] + ".png"
else:
    picFName = argv[3]

bl = blockMatchClass(argv[1], "rfd", postFile=argv[2])  # , selectRoi = True)
bl.CreateStrainImage(pngFileName=picFName, vMax=vMax)

bl.DisplayScanConvertedStrainImage(vMax)

answer = None
while answer is not "Y" and answer is not "N":
    answer = raw_input("Is the plotting scale satisfactory? (Y or N)?\n")

if answer is "Y":
    satisfiedWithScale = True
else:
    satisfiedWithScale = False

while not satisfiedWithScale:
    newMax = float(raw_input("Enter a new maximum strain value to display\n"))
コード例 #7
0
    sys.exit()

#Establish paths'''
BASE_PATH, RFD_NAME = os.path.split(os.path.abspath(sys.argv[1]))
print "\nProcessing file named: " + RFD_NAME + "\non path: " + BASE_PATH + "\n"
RESULT_DIR = BASE_PATH +'/' + RFD_NAME[:-4] + 'Results'
if os.path.isdir(RESULT_DIR):
    print "\nError, data set already processed."
    print "Directory: " + RESULT_DIR + " Exists. \n"
    sys.exit()

os.makedirs(RESULT_DIR)
os.makedirs(RESULT_DIR + '/blockMatch')
#Perform block-matching
from blockMatch import blockMatchClass
bl = blockMatchClass(BASE_PATH +'/'+ RFD_NAME, 'multiFocus', selectRoi = True)

for frameNo in range(bl.nFrames - 1 - 4):
    for skipNo in range(5):

        bl.CreateStrainImage(preFrame = frameNo, skipFrame = skipNo, itkFileName = RESULT_DIR + '/blockMatch/frame_' + str(frameNo) +'_'
        + str(frameNo + 1 + skipNo) , vMax = STRAIN_THRESHOLD )

#After block-matching I compute the frame triplets with the optimum DQM
import numpy
from numpy import zeros
import SimpleITK as sitk
import cv
from scipy.interpolate import interp1d, RectBivariateSpline
from interp2NoSplines import interp2
DQM = zeros( bl.nFrames )
コード例 #8
0
    sys.exit()
# Establish paths'''
BASE_PATH, RFD_NAME = os.path.split(os.path.abspath(sys.argv[1]))
print "\nProcessing file named: " + RFD_NAME + "\non path: " + BASE_PATH + "\n"
RESULT_DIR = BASE_PATH + "/" + RFD_NAME[:-4] + "Results"
if os.path.isdir(RESULT_DIR):
    print "\nError, data set already processed."
    print "Directory: " + RESULT_DIR + " Exists. \n"
    sys.exit()

os.makedirs(RESULT_DIR)
os.makedirs(RESULT_DIR + "/blockMatch")
# Perform block-matching
from blockMatch import blockMatchClass

bl = blockMatchClass(BASE_PATH + "/" + RFD_NAME, "rfd", selectRoi=True)
bl.nFrames = 62
for frameNo in range(bl.nFrames - 1 - 4):
    for skipNo in range(5):

        bl.CreateStrainImage(
            preFrame=frameNo,
            skipFrame=skipNo,
            itkFileName=RESULT_DIR + "/blockMatch/frame_" + str(frameNo) + "_" + str(frameNo + 1 + skipNo),
            vMax=STRAIN_THRESHOLD,
        )

# After block-matching I compute the frame triplets with the optimum DQM
import numpy
from numpy import zeros
import SimpleITK as sitk