def on_LoadXray_released(self): """ Slot documentation goes here. """ fileName = QFileDialog.getOpenFileName(self, "Open X-ray File", "","DICOM Files (*.dcm)") (reader, img) = dicom.open_image(str(fileName)) self.mOrignialXRayImage = img self.display_image( self.mOrignialXRayImage ) self.dectectJointsButton.enabledChange(True) print str(fileName)
def on_LoadXray_released(self): """ Slot documentation goes here. """ fileName = QFileDialog.getOpenFileName(self, "Open X-ray File", "", "DICOM Files (*.dcm)") (reader, img) = dicom.open_image(str(fileName)) self.mOrignialXRayImage = img self.display_image(self.mOrignialXRayImage) self.dectectJointsButton.enabledChange(True) print str(fileName)
def __init__(self): self.fileNameRef = '../training/Case1.dcm' (reader, self.imgSample) = dicom.open_image(str(self.fileNameRef)) self.imgSample = self.resize_image(self.imgSample) self.patch = self.imgSample[50:100][:,185:270] # only tip
#> ipython --pylab --deep-reload import numpy as np scores = np.loadtxt('../training/scores.txt') import dicom (reader, img) = dicom.open_image("../training/Case1.dcm") from AgeDetermination import AgeDetermination aClass = AgeDetermination() aClass.detect_joints_of_interest(img) # in ipython run -> # run fromShell.py
#scores = np.loadtxt('../training/scores.txt') aClass = AgeDetermination() directory = '../extractedJoints' if not os.path.exists(directory): os.makedirs(directory) #Add numbers of the working studies here: okImg = [ 1, 2, 3, 4, 6, 7, 9, 10, 11, 12, 13, 15, 17, 19, 20, 21, 22, 23, 26, 27, 28, 29, 30, 33 ] for i in okImg: (reader, img) = dicom.open_image("../training/Case" + str(i) + ".dcm") fingers = aClass.detect_joints_of_interest(img) if (len(fingers) == 2): if (len(fingers['littleFinger']) == 3): jointNum = 1 for joint in fingers['littleFinger']: imsave( directory + '/' + str(i) + "_littleFinger_" + str(jointNum) + ".png", joint) jointNum = jointNum + 1 if (len(fingers['middleFinger']) == 3): jointNum = 1 for joint in fingers['middleFinger']: imsave(
images=list() fingerImagesPool[finger]=images imgLF1=Image.new('L',size) images.append(imgLF1) imgLF2=Image.new('L',size) images.append(imgLF2) if (images!='thumb'): imgLF3=Image.new('L',size) images.append(imgLF3) for i in okImg: (reader, img) = dicom.open_image("../training/Case" + str(i) + ".dcm") fingers = aClass.detect_joints_of_interest(img) for fingerName in evaluatedFingers: if(len(fingers)==3): if(len(fingers[fingerName])>=2): jointNum=1 for joint in fingers[fingerName]: #imagesLF[jointNum-1].paste(Image.fromarray((255.0*255.0/joint.max()*(joint-joint.min())).astype(np.uint16)),((i-1)*140,0)) fingerImagesPool[fingerName][jointNum-1].paste(Image.fromarray((255.0/joint.max()*(joint-joint.min())).astype(np.uint8)),((i-1)*140,0)) #imagesLF[jointNum-1].paste(Image.fromarray(joint,'L'),((i-1)*140,0)) jointNum = jointNum+1 #write down images
def __init__(self): self.fileNameRef = '../training/Case1.dcm' (reader, self.imgSample) = dicom.open_image(str(self.fileNameRef)) self.imgSample = self.resize_image(self.imgSample) self.patch = self.imgSample[50:100][:, 185:270] # only tip