group = parser.add_mutually_exclusive_group() group.add_argument("-y", "--yview", help="swap axes", action="store_true") group.add_argument("-x", "--xview", help="swap axes", action="store_true") args = parser.parse_args() if args.outfile: outfname = args.outfile if args.inputpath: inpath = args.inputpath dataRGB, ROI = read_files(inpath, args.filterROI, args.verbose) if args.verbose: print(dataRGB.shape) dataswappedY = np.swapaxes(dataRGB,0,2) #dataswappedX = np.fliplr(np.swapaxes(np.swapaxes(dataRGB,0,1),1,2)) dataswappedX = np.swapaxes(np.swapaxes(dataRGB,0,1),1,2) # dataM=np.multiply(data,ROI) app = QtGui.QApplication([]) ## Create window with ImageView widget win = QtGui.QMainWindow() win.resize(800,800)
# if len(infilesROI) != len(infiles): # print("ERROR: in the directory ",inpath," there are ",len(infiles)," dicom files") # print("while in the ROI directory ",inpathROI," there are ",len(infilesROI)," dicom files") # dicomsROI=[] # for infileROI in infilesROI: # dicomsROI.append(dicom.read_file(infileROI)) # for i, thisROI in enumerate(dicomsROI): # pix_arr = thisROI.pixel_array # ROI[i] = pix_arr.T # for i, thisdicom in enumerate(dicoms): # pix_arr = thisdicom.pixel_array # data[i] = pix_arr.T data, ROI = read_files(inpath,args.filterROI, args.verbose, True) outfile= ROOT.TFile(outfname,"RECREATE") his, allhistos = make_histo(data,ROI) his.Write() for thishisto in allhistos: thishisto.Write() # histograms = [] # for i, fetta, fettaROI in enumerate(zip(data,ROI)): # if fettaROI.max() > 0 : # histogram = make_histo(fetta, fettaROI) # histogram.SetName("h"+str(i)) # histogram.SetTitle("h"+str(i))
group.add_argument("-y", "--yview", help="swap axes", action="store_true") group.add_argument("-x", "--xview", help="swap axes", action="store_true") args = parser.parse_args() layer = 0 if args.outfile: outfname = args.outfile if args.inputpath: inpath = args.inputpath if args.layer: layer = args.layer dataRGB, ROI = read_files(inpath, False, args.verbose, False) data = dataRGB[:, :, ::-1, 0] if args.verbose: print(data.shape) print("layer: ", layer) dataswappedY = np.swapaxes(data, 0, 2) dataswappedX = np.swapaxes(np.swapaxes(data, 0, 1), 1, 2) ## create GUI app = QtGui.QApplication([]) w = pg.GraphicsWindow(size=(1280, 768), border=True) w.setWindowTitle("dicom with ROI") text = """Click on a line segment to add a new handle.
# if len(infilesROI) != len(infiles): # print("ERROR: in the directory ",inpath," there are ",len(infiles)," dicom files") # print("while in the ROI directory ",inpathROI," there are ",len(infilesROI)," dicom files") # dicomsROI=[] # for infileROI in infilesROI: # dicomsROI.append(dicom.read_file(infileROI)) # for i, thisROI in enumerate(dicomsROI): # pix_arr = thisROI.pixel_array # ROI[i] = pix_arr.T # for i, thisdicom in enumerate(dicoms): # pix_arr = thisdicom.pixel_array # data[i] = pix_arr.T data, ROI = read_files(inpath, args.filterROI, args.verbose, True) outfile = ROOT.TFile(outfname, "RECREATE") if args.filterROI: his, allhistos = make_histo(data, ROI) his.Write() else: allhistos = make_histo_ofallpixels(data, "", args.verbose, args.normalize) for thishisto in allhistos: thishisto.Write() # histograms = [] # for i, fetta, fettaROI in enumerate(zip(data,ROI)):
"--filterROI", help="filter the image with a ROI (folder path, nrrd file supported)") group = parser.add_mutually_exclusive_group() group.add_argument("-y", "--yview", help="swap axes", action="store_true") group.add_argument("-x", "--xview", help="swap axes", action="store_true") args = parser.parse_args() if args.outfile: outfname = args.outfile if args.inputpath: inpath = args.inputpath dataRGB, ROI = read_files(inpath, args.filterROI, args.verbose) if args.verbose: print(dataRGB.shape) dataswappedY = np.swapaxes(dataRGB, 0, 2) #dataswappedX = np.fliplr(np.swapaxes(np.swapaxes(dataRGB,0,1),1,2)) dataswappedX = np.swapaxes(np.swapaxes(dataRGB, 0, 1), 1, 2) # dataM=np.multiply(data,ROI) app = QtGui.QApplication([]) ## Create window with ImageView widget win = QtGui.QMainWindow() win.resize(800, 800) imv = pg.ImageView()
group.add_argument("-y", "--yview", help="swap axes", action="store_true") group.add_argument("-x", "--xview", help="swap axes", action="store_true") args = parser.parse_args() layer = 0 if args.outfile: outfname = args.outfile if args.inputpath: inpath = args.inputpath if args.layer: layer = args.layer dataRGB, ROI = read_files(inpath, False, args.verbose, False) data = dataRGB[:, :, ::-1, 0] if args.verbose: print(data.shape) print("layer: ", layer) dataswappedY = np.swapaxes(data, 0, 2) dataswappedX = np.swapaxes(np.swapaxes(data, 0, 1), 1, 2) ## create GUI app = QtGui.QApplication([]) w = pg.GraphicsWindow(size=(1280, 768), border=True) w.setWindowTitle('dicom with ROI') text = """Click on a line segment to add a new handle.