Пример #1
0
 def file_save(self):
     filename = QtGui.QFileDialog.getSaveFileName(self, 'Save File')
     writer = roiFileHandler()
     writer.dicomsPath = os.path.abspath(self.inpath)
     if not str(filename).endswith('.myroi'):
         filename = filename + ".myroi"
     writer.write(filename, self.rois, self.roisSetted)
Пример #2
0
 def file_open(self):
     filename = QtGui.QFileDialog.getOpenFileName(self, 'Open File','ROI','ROI files (*.myroi)')
     reader = roiFileHandler()
     originalpath = reader.dicomsPath
     self.rois, self.roisSetted = reader.read(filename)
     self.updatemain()
     self.label2_roisSetted.setText("ROI setted: "+str(self.roisSetted))
Пример #3
0
 def file_save(self):
     filename = QtGui.QFileDialog.getSaveFileName(self, 'Save File')
     writer = roiFileHandler()
     writer.dicomsPath = os.path.abspath(self.inpath)
     if not str(filename).endswith('.myroi'):
         filename = filename+".myroi"
     writer.write(filename, self.rois, self.roisSetted)
Пример #4
0
 def file_open(self):
     filename = QtGui.QFileDialog.getOpenFileName(self, 'Open File', 'ROI',
                                                  'ROI files (*.myroi)')
     reader = roiFileHandler()
     originalpath = reader.dicomsPath
     self.rois, self.roisSetted = reader.read(filename)
     self.updatemain()
     self.label2_roisSetted.setText("ROI setted: " + str(self.roisSetted))
        timeflag[0] = int(lines[3])
        ypT[0] = int(lines[4])

        # data, ROI = read_files(pathT2, pathROI, args.verbose, True)
        freader = FileReader(pathT2, pathROI, args.verbose)
        data, ROI = freader.read(True)

        roinorm = False

        if args.verbose:
            print("dicom file read")

        if args.norm:
            myroifilename = lines[5]

            roireader = roiFileHandler(args.verbose)
            myroisnorm, roisnormSetted = roireader.read(myroifilename)

            roinorm = myroi2roi(myroisnorm, data.shape, args.verbose)

            if args.verbose:
                print("norm file read")
        if args.verbose:
            print("data mean:", data.mean(), "min:", data.min(), "max:",
                  data.max(), "shape:", data.shape)
            print("ROI mean:", ROI.mean(), "min:", ROI.min(), "max:",
                  ROI.max(), "shape:", ROI.shape)
        patientsuffix = lines[0] + str(timeflag[0])
        if timeflag[0] != 0 and timeflag[0] != 1 and timeflag[0] != 2:
            print(
                "ERROR: timeflag (0 for pre, 1 for int and 2 for post) of patient "
Пример #6
0
        timeflag[0] = int(lines[3])
        ypT[0] = int(lines[4])

        # data, ROI = read_files(pathT2, pathROI, args.verbose, True)
        freader = FileReader(pathT2, pathROI, args.verbose)
        data, ROI = freader.read(True)

        roinorm=False
        
        if args.verbose:
            print("dicom file read")
            
        if args.norm:
            myroifilename = lines[5]
        
            roireader = roiFileHandler(args.verbose)
            myroisnorm, roisnormSetted = roireader.read(myroifilename)
            
            roinorm = myroi2roi(myroisnorm, data.shape, args.verbose)
    
            if args.verbose:
                print("norm file read")
        
        patientsuffix=lines[0]+str(timeflag[0])
        if timeflag[0] != 0 and timeflag[0] != 1 and timeflag[0] != 2:
            print("ERROR: timeflag (0 for pre, 1 for int and 2 for post) of patient "+lines[0]+ "is: "+timeflag[0])
            raise NameError('OutOfRange')
        his, allhistos, histogiafatti = make_histo(data,ROI,patientsuffix,args.verbose,roinorm,args.norm)
    
        nVoxel[0]   = int(his.GetEntries())
        mean[0]     = his.GetMean()
Пример #7
0
if args.inputpath:
    inpath = args.inputpath

if args.roi:
    myroifilename = args.roi

if args.outfile:
    outfname = args.outfile    

out_file = open(outfname,"w")
out_file.write("#layer \t max \t meaninroi \n")
    
freader = FileReader(inpath, False, args.verbose)
data, unusedROI = freader.read(True)

roireader = roiFileHandler()
rois, roisSetted = roireader.read(myroifilename)

nFette = len(data)
if nFette != len(rois):
    print("error: len rois = ",len(rois)," but len dicom=",nFette)

    
for layer in xrange(0,nFette):
    thisroi = grid_points_in_poly(data[layer].shape, rois[layer]['points'])
    masked = data[layer]*thisroi
    maximum = data[layer].max()
    meaninroi = masked.mean()
    out_file.write(str(layer)+"\t"+str(maximum)+"\t"+str(meaninroi)+"\n")

out_file.close()