def reconstruct(self): self.recon.lbl.setText("Reconstruction is currently running") self.d= tomopy.xtomo_dataset(log='debug') self.reconelement=self.recon.combo.currentIndex() self.d.data=self.data[self.reconelement,:,:,:] self.d.data[self.d.data==inf]=0.01 self.d.data[np.isnan(self.d.data)]=0.01 ###TEMP if self.recon.reconvalue==0: self.d.data = (np.exp(-0.0001*self.d.data)).astype('float32') else: print "transmission" #self.d.center=128 ###TEMP self.d.center=self.p1[2] if self.recon.method.currentIndex()==0: self.d.dataset(self.d.data, theta=self.theta*np.pi/180) #self.d.optimize_center() self.d.mlem() elif self.recon.method.currentIndex()==1: self.d.dataset(self.d.data, theta=self.theta) #self.d.optimize_center() self.d.gridrec() elif self.recon.method.currentIndex()==2: self.d.dataset(self.d.data, theta=self.theta*np.pi/180) #self.d.optimize_center() self.d.art() print self.d.center pg.image(self.d.data_recon) self.recon.lbl.setText("Done") self.recon.save.setHidden(False)
def reconstruct(self): self.recon.lbl.setText("Reconstruction is currently running") self.d = tomopy.xtomo_dataset(log='debug') self.reconelement = self.recon.combo.currentIndex() self.d.data = self.data[self.reconelement, :, :, :] self.d.data[self.d.data == inf] = 0.01 self.d.data[np.isnan(self.d.data)] = 0.01 ###TEMP if self.recon.reconvalue == 0: self.d.data = (np.exp(-0.0001 * self.d.data)).astype('float32') else: print "transmission" #self.d.center=128 ###TEMP self.d.center = self.p1[2] if self.recon.method.currentIndex() == 0: self.d.dataset(self.d.data, theta=self.theta * np.pi / 180) #self.d.optimize_center() self.d.mlem() elif self.recon.method.currentIndex() == 1: self.d.dataset(self.d.data, theta=self.theta) #self.d.optimize_center() self.d.gridrec() elif self.recon.method.currentIndex() == 2: self.d.dataset(self.d.data, theta=self.theta * np.pi / 180) #self.d.optimize_center() self.d.pml() print self.d.center pg.image(self.d.data_recon) self.recon.lbl.setText("Done") self.recon.save.setHidden(False)
def main(): # read a series of tiff # oster: pj: from 0 -> 1440; bf from 0 -> 19; df from 0 -> 19 file_name = '/local/dataraid/databank/PetraIII/2011_KW16_oster/oster02_0001/scan_0002/ccd/pco01/ccd_.tif' dark_file_name = '/local/dataraid/databank/PetraIII/2011_KW16_oster/oster02_0001/scan_0000/ccd/pco01/ccd_.tif' white_file_name = '/local/dataraid/databank/PetraIII/2011_KW16_oster/oster02_0001/scan_0001/ccd/pco01/ccd_.tif' projections_start = 0 projections_end = 1441 white_start = 0 white_end = 20 white_step = 1 dark_start = 0 dark_end = 20 dark_step = 1 # to reconstruct slices from slices_start to slices_end # if omitted all data set is recontructed slices_start = 1000 slices_end = 1004 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.xtomo_raw( file_name, projections_start=projections_start, projections_end=projections_end, slices_start=slices_start, slices_end=slices_end, #projections_angle_range=360, white_file_name=white_file_name, white_start=white_start, white_end=white_end, white_step=white_step, dark_file_name=dark_file_name, dark_start=dark_start, dark_end=dark_end, dark_step=dark_step, projections_digits=4, projections_zeros=True, log='INFO') # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval(pixel_size=0.9e-4, dist=6.9, energy=15.25) #d.correct_drift() d.center = 1872.87890625 d.gridrec() # Write to stack of TIFFs. mydata = ex.Export() mydata.xtomo_tiff(data=d.data_recon, output_file='tmp/PetraIII_tiff_2_tomoPy_', axis=0)
def main(): # read a series of tiff file_name = '/local/dataraid/databank/Elettra/Volcanic_rock/tomo_.tif' dark_file_name = '/local/dataraid/databank/Elettra/Volcanic_rock/dark_.tif' white_file_name = '/local/dataraid/databank/Elettra/Volcanic_rock/flat_.tif' projections_start = 1 projections_end = 1441 white_start = 1 white_end = 11 white_step = 1 dark_start = 1 dark_end = 11 dark_step = 1 sample_name = 'Volcanic_rock' # to reconstruct slices from slices_start to slices_end # if omitted all data set is recontructed slices_start = 150 slices_end = 154 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.xtomo_raw(file_name, projections_start = projections_start, projections_end = projections_end, projections_digits = 4, slices_start = slices_start, slices_end = slices_end, white_file_name = white_file_name, white_start = white_start, white_end = white_end, white_step = white_step, dark_file_name = dark_file_name, dark_start = dark_start, dark_end = dark_end, dark_step = dark_step, data_type = 'compressed_tiff', # comment this line if regular tiff projections_zeros = True, white_zeros = False, dark_zeros = False, log='INFO' ) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center=1096.375 d.gridrec() # Write to stack of TIFFs. mydata = ex.Export() mydata.xtomo_tiff(data = d.data_recon, output_file = 'tmp/Elettra_tiff_2_tomoPy_', axis=0)
def main(): # read a series of tiff # oster: pj: from 0 -> 1440; bf from 0 -> 19; df from 0 -> 19 file_name = '/local/dataraid/databank/PetraIII/2011_KW16_oster/oster02_0001/scan_0002/ccd/pco01/ccd_.tif' dark_file_name = '/local/dataraid/databank/PetraIII/2011_KW16_oster/oster02_0001/scan_0000/ccd/pco01/ccd_.tif' white_file_name = '/local/dataraid/databank/PetraIII/2011_KW16_oster/oster02_0001/scan_0001/ccd/pco01/ccd_.tif' projections_start = 0 projections_end = 1441 white_start = 0 white_end = 20 white_step = 1 dark_start = 0 dark_end = 20 dark_step = 1 # to reconstruct slices from slices_start to slices_end # if omitted all data set is recontructed slices_start = 1000 slices_end = 1004 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.xtomo_raw(file_name, projections_start = projections_start, projections_end = projections_end, slices_start = slices_start, slices_end = slices_end, #projections_angle_range=360, white_file_name = white_file_name, white_start = white_start, white_end = white_end, white_step = white_step, dark_file_name = dark_file_name, dark_start = dark_start, dark_end = dark_end, dark_step = dark_step, projections_digits = 4, projections_zeros = True, log='INFO' ) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval(pixel_size=0.9e-4, dist=6.9, energy=15.25) #d.correct_drift() d.center=1872.87890625 d.gridrec() # Write to stack of TIFFs. mydata = ex.Export() mydata.xtomo_tiff(data = d.data_recon, output_file = 'tmp/PetraIII_tiff_2_tomoPy_', axis=0)
def main(): # read a series of tiff file_name = '/local/dataraid/databank/AS/Mayo_tooth_AS/SAMPLE_T_.tif' dark_file_name = '/local/dataraid/databank/AS/Mayo_tooth_AS/DF__BEFORE_.tif' white_file_name = '/local/dataraid/databank/AS/Mayo_tooth_AS/BG__BEFORE_.tif' sample_name = 'Teeth' projections_start = 0 projections_end = 1801 white_start = 0 white_end = 10 white_step = 1 dark_start = 0 dark_end = 10 dark_step = 1 # to reconstruct slices from slices_start to slices_end # if omitted all data set is recontructed slices_start = 290 slices_end = 294 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.xtomo_raw(file_name, projections_start = projections_start, projections_end = projections_end, slices_start = slices_start, slices_end = slices_end, white_file_name = white_file_name, white_start = white_start, white_end = white_end, white_step = white_step, dark_file_name = dark_file_name, dark_start = dark_start, dark_end = dark_end, dark_step = dark_step, projections_digits = 4, white_digits = 2, dark_digits = 2, projections_zeros = True, log='INFO' ) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center=1184.0 d.gridrec() # Write to stack of TIFFs. mydata = ex.Export() mydata.xtomo_tiff(data = d.data_recon, output_file = 'tmp/Australian_tiff_2_tomoPy_', axis=0)
def main(): # read a series of SPE file_name = '/local/dataraid/databank/APS_13_BM/SPE/run2_soln1_2_.SPE' hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/APS_13_BM_test_04.h5' white_start = 1 white_end = 8 white_step = 2 projections_start = 2 projections_end = 7 projections_step = 2 # set to convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 100 slices_end = 104 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.series_of_images(file_name, projections_start = projections_start, projections_end = projections_end, projections_step = projections_step, slices_start = slices_start, slices_end = slices_end, white_start = white_start, white_end = white_end, white_step = white_step, projections_zeros=False, white_zeros=False, dark_zeros=False, data_type='spe', sample_name = 'Stripe_Solder_Sample_Tip1', log='INFO' ) ## # if you have already created a data exchange file using convert_SLS.py module, ## # comment the call above and read the data set as data exchange ## # Read HDF5 file. ## data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, ## slices_start=0, ## slices_end=2) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center=705 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/APS_13BM_', axis=0)
def run(self): data_orig,theta,channelname=xtomo_reader_gui(self.h5files) writetxt(channelname) projections=len(self.h5files) diff=array([ -4, 5, 8, 4, 3, -3, -10, -10, -7, 3, 1, 6, 6, 4, 0, 1, 3, 0, -9], dtype=int32) #diff=diff[int(projections_start)-172:int(projections_end)-172+1] element=zeros(1) element[0]=7 count=element.shape[0] for numb in arange(count): elem=element[numb] data=data_orig[elem,:,:,:] for i in arange(projections): olddata=data[i,:,:] data[i,:,:]=np.roll(olddata[:,:],diff[i],axis=1) sino=sinogram(data) if sinogramsave==True: j=Image.fromarray(sino.astype(np.float32)) try: j.save(os.getcwd()+"/sinogram/"+channelname[elem]+"_sinogram.tiff") print "saving sinogram... " print os.getcwd()+"/sinogram/"+channelname[elem]+"_sinogram.tiff" except IOError: os.mkdir(os.getcwd()+"/sinogram") j.save(os.getcwd()+"/sinogram/"+channelname[elem]+"_sinogram.tiff") print "saving sinogram... " print os.getcwd()+"/sinogram/"+channelname[elem]+"_sinogram.tiff" #data=np.expand_dims(data[:,25,:],axis=1) # Xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') data[data == inf] = 1 d.dataset(data, theta=theta*np.pi/180) d.center=959 print reconstructiontype, channelname[elem] if reconstructiontype=="mlem": d.mlem() if reconstructiontype=="art": d.art() if reconstructiontype=="gridrec": d.gridrec() xtomo_writer_f(d.data_recon, 'tmp/'+str(channelname[elem])+'/' +reconstructiontype+'/test_'+str(d.center), axis=0)
def main(): file_name = '/local/dataraid/databank/CHESS/scan1/scan1_.tiff' dark_file_name = '/local/dataraid/databank/CHESS/scan1/scan1_dark_.tiff' white_file_name = '/local/dataraid/databank/CHESS/scan1/scan1_white_.tiff' hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/CHESS_02.h5' sample_name = 'Dummy' projections_start = 1 projections_end = 361 white_start = 0 white_end = 1 white_step = 1 dark_start = 0 dark_end = 1 dark_step = 1 # set to convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 400 slices_end = 405 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.series_of_images(file_name, projections_start = projections_start, projections_end = projections_end, slices_start = slices_start, slices_end = slices_end, sample_name = sample_name, projections_digits = 3, projections_zeros = True, log='INFO' ) # and/or read as data exchange # Read HDF5 file. ##data, white, dark, theta = tomopy.xtomo_reader('/local/dataraid/databank/dataExchange/microCT/CHESS_01.h5', ## slices_start=100, ## slices_end=101) # Xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() d.optimize_center() #d.phase_retrieval() #d.correct_drift() #d.center=99.5 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/CHESS_scan1_', axis=0)
def main(): # read a series of SPE file_name = '/local/dataraid/databank/APS_13_BM/SPE/run2_soln1_2_.SPE' hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/APS_13_BM_test_04.h5' white_start = 1 white_end = 8 white_step = 2 projections_start = 2 projections_end = 7 projections_step = 2 # set to convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 100 slices_end = 104 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.series_of_images( file_name, projections_start=projections_start, projections_end=projections_end, projections_step=projections_step, slices_start=slices_start, slices_end=slices_end, white_start=white_start, white_end=white_end, white_step=white_step, projections_zeros=False, white_zeros=False, dark_zeros=False, data_type='spe', sample_name='Stripe_Solder_Sample_Tip1', log='INFO') ## # if you have already created a data exchange file using convert_SLS.py module, ## # comment the call above and read the data set as data exchange ## # Read HDF5 file. ## data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, ## slices_start=0, ## slices_end=2) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center = 705 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/APS_13BM_', axis=0)
def main(): # read a series of netCDF file_name = '/local/dataraid/databank/APS_13_BM/NC/Dorthe_F_.nc' hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/APS_13_BM_NC_test_02.h5' white_start = 1 white_end = 4 white_step = 2 projections_start = 2 projections_end = 3 projections_step = 1 # set to convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 300 slices_end = 304 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.series_of_images(file_name, projections_start = projections_start, projections_end = projections_end, projections_step = projections_step, slices_start = slices_start, slices_end = slices_end, white_start = white_start, white_end = white_end, white_step = white_step, projections_digits = 3, data_type='nc', log='INFO' ) ## # if you have already created a data exchange file using convert_SLS.py module, ## # comment the call above and read the data set as data exchange ## # Read HDF5 file. ## data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, ## slices_start=0, ## slices_end=2) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center=484.5 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/APS_13BM_', axis=0)
def main(): file_name = '/local/dataraid/databank/CHESS/scan1/scan1_.tiff' dark_file_name = '/local/dataraid/databank/CHESS/scan1/scan1_dark_.tiff' white_file_name = '/local/dataraid/databank/CHESS/scan1/scan1_white_.tiff' hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/CHESS_02.h5' sample_name = 'Dummy' projections_start = 1 projections_end = 361 white_start = 0 white_end = 1 white_step = 1 dark_start = 0 dark_end = 1 dark_step = 1 # set to convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 400 slices_end = 405 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.series_of_images( file_name, projections_start=projections_start, projections_end=projections_end, slices_start=slices_start, slices_end=slices_end, sample_name=sample_name, projections_digits=3, projections_zeros=True, log='INFO') # and/or read as data exchange # Read HDF5 file. ##data, white, dark, theta = tomopy.xtomo_reader('/local/dataraid/databank/dataExchange/microCT/CHESS_01.h5', ## slices_start=100, ## slices_end=101) # Xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() d.optimize_center() #d.phase_retrieval() #d.correct_drift() #d.center=99.5 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/CHESS_scan1_', axis=0)
def main(): # read a series of netCDF file_name = '/local/dataraid/databank/APS_13_BM/NC/Dorthe_F_.nc' hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/APS_13_BM_NC_test_02.h5' white_start = 1 white_end = 4 white_step = 2 projections_start = 2 projections_end = 3 projections_step = 1 # set to convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 300 slices_end = 304 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.series_of_images( file_name, projections_start=projections_start, projections_end=projections_end, projections_step=projections_step, slices_start=slices_start, slices_end=slices_end, white_start=white_start, white_end=white_end, white_step=white_step, projections_digits=3, data_type='nc', log='INFO') ## # if you have already created a data exchange file using convert_SLS.py module, ## # comment the call above and read the data set as data exchange ## # Read HDF5 file. ## data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, ## slices_start=0, ## slices_end=2) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center = 484.5 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/APS_13BM_', axis=0)
def main(): file_name = '/local/dataraid/databank/ESRF/scan.edf' dark_file_name = '/local/dataraid/databank/ESRF/dark.edf' white_file_name = '/local/dataraid/databank/ESRF/flat.edf' # only defined if used a converter # omit when used as direct importer in tomoPy hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/ESRF_test_02.h5' sample_name = 'esrf' # set to import/convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 300 slices_end = 304 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.series_of_images(file_name, white_file_name = white_file_name, dark_file_name = dark_file_name, sample_name = sample_name, slices_start = slices_start, slices_end = slices_end, data_type='edf', log='INFO' ) ## # if you have already created a data exchange file using convert_SLS.py module, ## # comment the call above and read the data set as data exchange with: ## # Read HDF5 file. ## data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, ## slices_start=0, ## slices_end=2) # TomoPy xtomo object creation and pipeline of methods. # for full set of options see http://tomopy.github.io/tomopy/ d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center=549.84 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/ESRF_OK', axis=0)
def main(): file_name = '/local/dataraid/2013_11/Vincent_201311/GA_exp/92_2_01/rad_0400ms_.tiff' white_file_name = '/local/dataraid/2013_11/Vincent_201311/GA_exp/92_2_01/ff_0350ms_.tiff' hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/NSLS.h5' white_start = 0 white_end = 2580 white_step = 30 projections_start = 0 projections_end = 2600 # set to convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 800 slices_end = 804 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.series_of_images(file_name, projections_start = projections_start, projections_end = projections_end, projections_digits=4, slices_start = slices_start, slices_end = slices_end, white_file_name = white_file_name, white_start = white_start, white_end = white_end, white_step = white_step, log='INFO' ) ## # if you have already created a data exchange file using convert_SLS.py module, ## # comment the call above and read the data set as data exchange ## # Read HDF5 file. ## data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, ## slices_start=0, ## slices_end=2) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center=1010.0 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/SLS_', axis=0)
def main(): file_name = '/local/dataraid/2013_11/Vincent_201311/GA_exp/92_2_01/rad_0400ms_.tiff' white_file_name = '/local/dataraid/2013_11/Vincent_201311/GA_exp/92_2_01/ff_0350ms_.tiff' hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/NSLS.h5' white_start = 0 white_end = 2580 white_step = 30 projections_start = 0 projections_end = 2600 # set to convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 800 slices_end = 804 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.series_of_images( file_name, projections_start=projections_start, projections_end=projections_end, projections_digits=4, slices_start=slices_start, slices_end=slices_end, white_file_name=white_file_name, white_start=white_start, white_end=white_end, white_step=white_step, log='INFO') ## # if you have already created a data exchange file using convert_SLS.py module, ## # comment the call above and read the data set as data exchange ## # Read HDF5 file. ## data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, ## slices_start=0, ## slices_end=2) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center = 1010.0 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/SLS_', axis=0)
def main(): # only used to locate the wavelenght.dpt and angle.dpt files raw_tiff_base_name = "/local/dataraid/databank/dataExchange/microCT/SRC/raw/FPA_16_18_18_TOMO_243_Fiber_2500_50_50_" hdf5_base_name = "/local/dataraid/databank/dataExchange/microCT/SRC/dx/FPA_16_18_18_TOMO_243_Fiber_2500_50_50_" log_file = raw_tiff_base_name + "wavelength.dpt" angle_file = raw_tiff_base_name + "angle.dpt" dir_name = os.path.dirname(hdf5_base_name) sample_name_prefix = os.path.basename(hdf5_base_name) print dir_name print sample_name_prefix file = open(log_file, 'r') for line in file: linelist=line.split(",") hdf5_file_name = hdf5_base_name+linelist[0]+"cm-1.h5" sample_name = hdf5_base_name+linelist[0]+"cm-1" # set to read slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 30 slices_end = 36 # to create a data exchange file use convert_SRC.py module, data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, slices_start=slices_start, slices_end=slices_end) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center=64 d.gridrec() # Write to stack of TIFFs. rec_name = dir_name + "/rec/" + sample_name_prefix + linelist[0] + "cm-1" # Write to stack of TIFFs. mydata = ex.Export() mydata.xtomo_tiff(data = d.data_recon, output_file = rec_name, axis=0) file.close()
def main(): # read a series of tiff file_name = '/local/dataraid/databank/Anka/radios/image_.tif' dark_file_name = '/local/dataraid/databank/Anka/darks/image_.tif' white_file_name = '/local/dataraid/databank/Anka/flats/image_.tif' projections_start = 0 projections_end = 3167 white_start = 0 white_end = 100 dark_start = 0 dark_end = 100 sample_name = 'Anka' # to reconstruct slices from slices_start to slices_end # if omitted all data set is recontructed slices_start = 800 slices_end = 804 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.xtomo_raw(file_name, projections_start = projections_start, projections_end = projections_end, slices_start = slices_start, slices_end = slices_end, white_file_name = white_file_name, white_start = white_start, white_end = white_end, dark_file_name = dark_file_name, dark_start = dark_start, dark_end = dark_end, projections_digits = 5, log='INFO' ) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center=993.825 d.gridrec() # Write to stack of TIFFs. mydata = ex.Export() mydata.xtomo_tiff(data = d.data_recon, output_file = 'tmp/Anka_tiff_2_tomoPy_', axis=0)
def main(): # read a series of SPE file_name = '/local/dataraid/databank/APS_13_BM/SPE/run2_soln1_2_.SPE' white_start = 1 white_end = 8 white_step = 2 projections_start = 2 projections_end = 7 projections_step = 2 # set to convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 100 slices_end = 104 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.xtomo_raw( file_name, projections_start=projections_start, projections_end=projections_end, projections_step=projections_step, slices_start=slices_start, slices_end=slices_end, white_start=white_start, white_end=white_end, white_step=white_step, projections_zeros=False, white_zeros=False, dark_zeros=False, projections_digits=1, data_type='spe', log='INFO') # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center = 705 d.gridrec() # Write to stack of TIFFs. mydata = ex.Export() mydata.xtomo_tiff(data=d.data_recon, output_file='tmp/APS_13_BM_spe_2_tomoPy_', axis=0)
def main(): file_name = '/local/dataraid/databank/ESRF/scan.edf' dark_file_name = '/local/dataraid/databank/ESRF/dark.edf' white_file_name = '/local/dataraid/databank/ESRF/flat.edf' # only defined if used a converter # omit when used as direct importer in tomoPy hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/ESRF_test_02.h5' sample_name = 'esrf' # set to import/convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 300 slices_end = 304 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.series_of_images( file_name, white_file_name=white_file_name, dark_file_name=dark_file_name, sample_name=sample_name, slices_start=slices_start, slices_end=slices_end, data_type='edf', log='INFO') ## # if you have already created a data exchange file using convert_SLS.py module, ## # comment the call above and read the data set as data exchange with: ## # Read HDF5 file. ## data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, ## slices_start=0, ## slices_end=2) # TomoPy xtomo object creation and pipeline of methods. # for full set of options see http://tomopy.github.io/tomopy/ d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center = 549.84 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/ESRF_OK', axis=0)
def main(): # read a series of SPE file_name = '/local/dataraid/databank/APS_13_BM/SPE/run2_soln1_2_.SPE' white_start = 1 white_end = 8 white_step = 2 projections_start = 2 projections_end = 7 projections_step = 2 # set to convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 100 slices_end = 104 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.xtomo_raw(file_name, projections_start = projections_start, projections_end = projections_end, projections_step = projections_step, slices_start = slices_start, slices_end = slices_end, white_start = white_start, white_end = white_end, white_step = white_step, projections_zeros=False, white_zeros=False, dark_zeros=False, projections_digits = 1, data_type='spe', log='INFO' ) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center=705 d.gridrec() # Write to stack of TIFFs. mydata = ex.Export() mydata.xtomo_tiff(data = d.data_recon, output_file = 'tmp/APS_13_BM_spe_2_tomoPy_', axis=0)
def main(): # read a series of netCDF file_name = '/local/dataraid/databank/APS_13_BM/NC/Dorthe_F_.nc' white_start = 1 white_end = 4 white_step = 2 projections_start = 2 projections_end = 3 projections_step = 1 # set to convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 300 slices_end = 304 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.xtomo_raw( file_name, projections_start=projections_start, projections_end=projections_end, projections_step=projections_step, slices_start=slices_start, slices_end=slices_end, white_start=white_start, white_end=white_end, white_step=white_step, projections_digits=3, data_type='nc', log='INFO') # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center = 484.5 d.gridrec() # Write to stack of TIFFs. mydata = ex.Export() mydata.xtomo_tiff(data=d.data_recon, output_file='tmp/APS_13_BM_netCDF_2_tomoPy_', axis=0)
def main(): file_name = '/local/dataraid/databank/CHESS/scan1/scan1_.tiff' dark_file_name = '/local/dataraid/databank/CHESS/scan1/scan1_dark_.tiff' white_file_name = '/local/dataraid/databank/CHESS/scan1/scan1_white_.tiff' projections_start = 1 projections_end = 361 white_start = 0 white_end = 1 white_step = 1 dark_start = 0 dark_end = 1 dark_step = 1 # set to convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 400 slices_end = 404 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.xtomo_raw(file_name, projections_start = projections_start, projections_end = projections_end, slices_start = slices_start, slices_end = slices_end, projections_digits = 3, projections_zeros = True, log='INFO' ) # Xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center=1160.5 d.gridrec() # Write to stack of TIFFs. mydata = ex.Export() mydata.xtomo_tiff(data = d.data_recon, output_file = 'tmp/CHESS_tiff_2_tomoPy_', axis=0)
def main(): # read a series of netCDF file_name = '/local/dataraid/databank/APS_13_BM/NC/Dorthe_F_.nc' white_start = 1 white_end = 4 white_step = 2 projections_start = 2 projections_end = 3 projections_step = 1 # set to convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 300 slices_end = 304 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.xtomo_raw(file_name, projections_start = projections_start, projections_end = projections_end, projections_step = projections_step, slices_start = slices_start, slices_end = slices_end, white_start = white_start, white_end = white_end, white_step = white_step, projections_digits = 3, data_type='nc', log='INFO' ) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center=484.5 d.gridrec() # Write to stack of TIFFs. mydata = ex.Export() mydata.xtomo_tiff(data = d.data_recon, output_file = 'tmp/APS_13_BM_netCDF_2_tomoPy_', axis=0)
def main(): file_name = '/local/dataraid/databank/APS_15_ID/AluminaStick_0A_fullRunRenamed/AluminaStick_.hdf' projections_start = 1 projections_end = 361 # to reconstruct a subset of slices set slices_start and slices_end # if omitted the full data set is recontructed slices_start = 800 slices_end = 804 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.xtomo_raw( file_name, projections_start=projections_start, projections_end=projections_end, slices_start=slices_start, slices_end=slices_end, projections_digits=4, data_type='hdf5', log='INFO') # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() d.phase_retrieval(pixel_size=0.9e-4, dist=8.1, energy=17) #d.correct_drift() d.center = 772.2 d.gridrec() # Write to stack of TIFFs. mydata = ex.Export() mydata.xtomo_tiff(data=d.data_recon, output_file='tmp/AluminaStick_0A_', axis=0)
def main(): file_name = '/local/dataraid/databank/TXM_26_ID/20130731_004_Stripe_Solder_Sample_Tip1_TomoScript_181imgs_p1s_b1.txrm' # white is saturated .... white_file_name = '/local/dataraid/databank/TXM_26_ID/20130731_001_Background_Reference_20imgs_p5s_b1.xrm' sample_name = '20130731_004_Stripe_Solder_Sample_Tip1' # set to convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 620 slices_end = 624 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.xtomo_raw(file_name, white_file_name = white_file_name, slices_start = slices_start, slices_end = slices_end, data_type='xradia', log='INFO') print "data:", data.shape, data.dtype print "white:", white.shape, white.dtype print "dark:", dark.shape, dark.dtype print "theta:", theta.shape, theta.dtype # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() d.center=510.0 d.gridrec() # Write to stack of TIFFs. mydata = ex.Export() mydata.xtomo_tiff(data = d.data_recon, output_file = 'tmp/APS_26_ID_xradia_2_tomoPy_', axis=0)
def hdf5_to_recon(inputDir = '.', inputFileName='out.h5', startSlice=None, endSlice=None, outputDir='./recon', outBase = 'recon_', center=None): # Make the output directory if it doesn't already exist. if not os.path.exists(outputDir): os.makedirs(outputDir) # This is the path to the input HDF5 file. inputFilePath = os.path.join(inputDir, inputFileName) # This is the path to the output files outputPath = os.path.join(outputDir, outBase) # Read HDF5 file. data, white, dark, theta = tomopy.xtomo_reader(inputFilePath, slices_start=startSlice, slices_end=endSlice) # Xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() d.phase_retrieval() d.correct_drift() # Appliy a median filter to the (images?) to improve the chance of success of the center finder. d.median_filter() # Find the center of rotation if center == None: d.optimize_center() else: d.center=center # Do the tomographic reconstruction d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, outputPath, axis=0, x_start=startSlice)
def main(): file_name = '/local/dataraid/databank/ESRF/scan.edf' dark_file_name = '/local/dataraid/databank/ESRF/dark.edf' white_file_name = '/local/dataraid/databank/ESRF/flat.edf' sample_name = 'esrf' # set to import/convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 300 slices_end = 304 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.xtomo_raw(file_name, white_file_name = white_file_name, dark_file_name = dark_file_name, slices_start = slices_start, slices_end = slices_end, data_type='edf', log='INFO' ) d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center=549.84 d.gridrec() # Write to stack of TIFFs. mydata = ex.Export() mydata.xtomo_tiff(data = d.data_recon, output_file = 'tmp/ESRF_edf_2_tomoPy_', axis=0)
def main(): # read a series of tiff file_name = '/local/dataraid/databank/dataExchange/microCT/Sangid_ShortFiber.h5' file_name = '/local/dataraid/databank/dataExchange/tmp/Elettra.h5' # to reconstruct slices from slices_start to slices_end # if omitted all data set is recontructed # slices_start = 1365 # slices_end = 1367 slices_start = 150 slices_end = 154 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.xtomo_raw(file_name, slices_start = slices_start, slices_end = slices_end, data_type='h5', log='INFO' ) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() #d.correct_drift() d.optimize_center() #d.phase_retrieval() #d.correct_drift() #d.center=1096.375 d.gridrec() # Write to stack of TIFFs. mydata = ex.Export() mydata.xtomo_tiff(data = d.data_recon, output_file = 'tmp/Elettra_DataExchange_2_tomoPy_', axis=0)
try: j.save(os.getcwd() + "/sinogram/" + channelname[elem] + "_sinogram.tiff") print "saving sinogram... " print os.getcwd( ) + "/sinogram/" + channelname[elem] + "_sinogram.tiff" except IOError: os.mkdir(os.getcwd() + "/sinogram") j.save(os.getcwd() + "/sinogram/" + channelname[elem] + "_sinogram.tiff") print "saving sinogram... " print os.getcwd( ) + "/sinogram/" + channelname[elem] + "_sinogram.tiff" #data=np.expand_dims(data[:,25,:],axis=1) # Xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') data[data == inf] = 1 whereAreNaNs = np.isnan(data) data[whereAreNaNs] = 1. #d.dataset(data, theta=theta) d.dataset(data[30:, :, :], theta=theta[30:] * np.pi / 180) #print d.data.shape #tomopy.xtomo_writer(d.data, 'tmp/test_', axis=1, overwrite=True) #d.normalize() #d.correct_drift() #d.phase_retrieval() #d.data = (np.exp(-0.0001*d.data)).astype('float32') #d.correct_drift() #tomopy.xtomo_writer(d.data, 'tmp/test_', axis=1, overwrite=True) #d.data[d.data is np.nan]=1.
def main(): file_name = '/local/dataraid/databank/als/data/raw/sacarroll/20140731_001306_2477A_x00y08/20140731_001306_2477A_x00y08_0000_.tif' dark_file_name = '/local/dataraid/databank/als/data/raw/sacarroll/20140731_001306_2477A_x00y08/20140731_001306_2477A_x00y08drk_.tif' white_file_name = '/local/dataraid/databank/als/data/raw/sacarroll/20140731_001306_2477A_x00y08/20140731_001306_2477A_x00y08bak_.tif' log_file = '/local/dataraid/databank/als/data/raw/sacarroll/20140731_001306_2477A_x00y08/20140731_001306_2477A_x00y08.sct' verbose = True # Read ALS log file data file = open(log_file, 'r') for line in file: if '-scanner' in line: Source = re.sub(r'-scanner ', "", line) if verbose: print 'Facility', Source if '-object' in line: Sample = re.sub(r'-object ', "", line) if verbose: print 'Sample', Sample if '-senergy' in line: Energy = re.findall(r'\d+.\d+', line) if verbose: print 'Energy', Energy[0] if '-scurrent' in line: Current = re.findall(r'\d+.\d+', line) if verbose: print 'Current', Current[0] if '-nangles' in line: Angles = re.findall(r'\d+', line) if verbose: print 'Angles', Angles[0] if '-num_bright_field' in line: WhiteEnd = re.findall(r'\d+', line) if '-num_dark_fields' in line: DarkEnd = re.findall(r'\d+', line) file.close() dark_start = 0 dark_end = int(DarkEnd[0]) dark_step = 1 white_start = 0 white_end = int(WhiteEnd[0]) white_step = 1 projections_start = 0 projections_end = int(Angles[0]) # set to convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 245 slices_end = 249 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.xtomo_raw(file_name = file_name, projections_start = projections_start, projections_end = projections_end, slices_start = slices_start, slices_end = slices_end, white_file_name = white_file_name, white_start = white_start, white_end = white_end, dark_file_name = dark_file_name, dark_start = dark_start, dark_end = dark_end, projections_digits = 4, log='INFO' ) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() d.center=1282.5 d.gridrec() # Write to stack of TIFFs. mydata = ex.Export() mydata.xtomo_tiff(data = d.data_recon, output_file = 'tmp/ALS_tiff_2_tomoPy_', axis=0)
def main(): # read a series of tiff file_name = '/local/dataraid/databank/SLS_2011/Hornby_SLS/Hornby_b.tif' log_file = '/local/dataraid/databank/SLS_2011/Hornby_SLS/Hornby.log' #Read SLS log file data file = open(log_file, 'r') for line in file: linelist=line.split() if len(linelist)>1: if (linelist[0]=="Number" and linelist[2]=="darks"): number_of_darks = int(linelist[4]) elif (linelist[0]=="Number" and linelist[2]=="flats"): number_of_flats = int(linelist[4]) elif (linelist[0]=="Number" and linelist[2]=="projections"): number_of_projections = int(linelist[4]) elif (linelist[0]=="Rot" and linelist[2]=="min"): rotation_min = float(linelist[6]) elif (linelist[0]=="Rot" and linelist[2]=="max"): rotation_max = float(linelist[6]) elif (linelist[0]=="Angular" and linelist[1]=="step"): angular_step = float(linelist[4]) file.close() dark_start = 1 dark_end = number_of_darks + 1 white_start = dark_end white_end = white_start + number_of_flats projections_start = white_end projections_end = projections_start + number_of_projections # to reconstruct a subset of slices set slices_start and slices_end # if omitted the full data set is recontructed slices_start = 800 slices_end = 804 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.xtomo_raw(file_name, projections_start = projections_start, projections_end = projections_end, projections_digits=4, slices_start = slices_start, slices_end = slices_end, white_start = white_start, white_end = white_end, dark_start = dark_start, dark_end = dark_end, log='INFO' ) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center=1010.0 d.gridrec() # Write to stack of TIFFs. mydata = ex.Export() mydata.xtomo_tiff(data = d.data_recon, output_file = 'tmp/SLS_tiff_2_tomoPy_', axis=0)
def recon_180(data_dir='.', file = 'out.h5', output_dir='/Volumes/Socha_MP8/', num_proj=1800, z=15, eng=27.4, lens=2, center=None): ##_________________________inputs_and_parameters_______________________ file_name = os.path.join(data_dir, file) output_file = output_dir+'/recon_'+file.split(".")[-2]+'/recon_'+file.split(".")[-2] +'_' d = tomopy.xtomo_dataset(log='debug') # Program does not complete a sample if actual number of slices is input. This somewhat arbitrary scaled value seems to work well. #num_proj = (3/2)*num_proj # These values work well with the computer's available memory and produce quality images. chunk_size = 50 margin_slices = 20 # Define pixel size from function argument lens. pxl = 0 if lens == 2: pxl = 5.5e-4 #for 2X lens elif lens == 5: pxl = 2.2e-4 #for 5X lens rat = 5e-04 num_chunk = np.int(np.ceil(num_proj / (chunk_size - margin_slices))) if num_proj == chunk_size: num_chunk = 1 ##________________________rescale_for_16-bit_image____________________ # data, white, dark, theta = tomopy.xtomo_reader(file_name, projections_start=1, slices_start=(np.int(num_proj/2)), slices_end=(np.int(num_proj/2))+chunk_size) # # d = tomopy.xtomo_dataset(log='debug') # d.dataset(data, white, dark, theta=theta) # d.zinger_removal(zinger_level=500, median_width=5) # d.normalize(negvals=1, cutoff=1) # #d.stripe_removal() # #d.phase_retrieval(alpha=0.005) # d.center=center # # d.gridrec() # d.apply_mask(ratio=0.95) # # data_min = d.data_recon.min() # data_max = d.data_recon.max() ##________________________reconstruction______________________________ #Importing small arrays of data from a saved numpy array. data = np.load('/Volumes/Socha_MP8/Mosquito_tomo/arrays/data.npy') white = np.load('/Volumes/Socha_MP8/Mosquito_tomo/arrays/whitedata.npy') dark = np.load('/Volumes/Socha_MP8/Mosquito_tomo/arrays/darkdata.npy') theta = np.load('/Volumes/Socha_MP8/Mosquito_tomo/arrays/data.npy') # Xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() d.phase_retrieval() d.correct_drift() d.center=661.5 d.gridrec() tomopy.xtomo_writer(output_file, dtype='uint16', axis=0, data_max=None, overwrite = True) d.FLAG_THETA = False print 'Finished reconstructing slices from ' + file
def main(): # read a series of tiff file_name = '/local/dataraid/databank/Anka/radios/image_.tif' dark_file_name = '/local/dataraid/databank/Anka/darks/image_.tif' white_file_name = '/local/dataraid/databank/Anka/flats/image_.tif' hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/Anka_test.h5' projections_start = 0 projections_end = 3167 white_start = 0 white_end = 100 dark_start = 0 dark_end = 100 sample_name = 'Anka' # to reconstruct slices from slices_start to slices_end # if omitted all data set is recontructed slices_start = 800 slices_end = 804 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.series_of_images(file_name, projections_start = projections_start, projections_end = projections_end, slices_start = slices_start, slices_end = slices_end, white_file_name = white_file_name, white_start = white_start, white_end = white_end, dark_file_name = dark_file_name, dark_start = dark_start, dark_end = dark_end, sample_name = sample_name, projections_digits = 5, log='INFO' ) ## # if you have already created a data exchange file using convert_SLS.py module, ## # comment the call above and read the data set as data exchange ## # Read HDF5 file. ## data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, ## slices_start=0, ## slices_end=2) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() d.optimize_center() #d.phase_retrieval() #d.correct_drift() #d.center=1010.0 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/ANKA_', axis=0)
# phase retrieval parameters z = 15. eng = 27. pxl = 5.5e-4 #for 2X lens #pxl = 2.2e-4 #for 5X lens rat = 5e-04 ######################### you input section - End ######################### ######################### initialization - Start ######################### file_name = os.path.join(data_dir, file) output_file = data_dir+'/recon_'+file.split(".")[-2]+'/recon_'+file.split(".")[-2] +'_' log_filename = data_dir+'/recon_'+file.split(".")[-2]+'/'+file.split(".")[-2] +'.log' # object d is for containing data that will be used for phase retrieval d = tomopy.xtomo_dataset(log='debug') # object d_recon is for containing data for reconstruction d_recon = tomopy.xtomo_dataset(log='debug') ######################### initialization - End ######################### ########################## finding num_overlap_pixels - Start ######################### #### phase retrieval - Start #### data, white, dark, theta = tomopy.xtomo_reader(file_name,slices_start=300,slices_end=310,white_start=3,white_end=9,dark_start=3,dark_end=9) data[0,:,:] = data[1,:,:] # in case the first projection image is corrupted d.dataset(data, white, dark, theta) d.normalize() d.stripe_removal(wname="db5",level=10,sigma=4.) data_size = d.data.shape d.phase_retrieval(dist=z, energy=eng, pixel_size=pxl, alpha=rat,padding=True) data_tem = d.data
def main(): file_name = '/local/dataraid/databank/APS_1_ID/APS1ID_Cat4B_2/CAT4B_2_.tif' log_file = '/local/dataraid/databank/APS_1_ID/APS1ID_Cat4B_2/CAT4B_2_TomoStillScan.dat' #Read APS 1-ID log file data file = open(log_file, 'r') for line in file: linelist=line.split() if len(linelist)>1: if (linelist[0]=="First" and linelist[1]=="image"): projections_start = int(linelist[4]) elif (linelist[0]=="Last" and linelist[1]=="image"): projections_end = int(linelist[4]) elif (linelist[0]=="Dark" and linelist[1]=="field"): dark_start = int(linelist[6]) elif (linelist[0]=="Number" and linelist[2]=="dark"): number_of_dark = int(linelist[5]) elif (linelist[0]=="White" and linelist[1]=="field"): white_start = int(linelist[6]) elif (linelist[0]=="Number" and linelist[2]=="white"): number_of_white = int(linelist[5]) file.close() dark_end = dark_start + number_of_dark white_end = white_start + number_of_white # to fix a data collection looging bug ? white_start = white_start + 1 dark_start = dark_start +1 projections_start = projections_start + 11 projections_end = projections_end - 9 ## # these are correct per Peter discussion ## projections_start = 943 ## projections_end = 1853 ## white_start = 1844 ## white_end = 1853 ## dark_start = 1854 ## dark_end = 1863 # set to convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 1000 slices_end = 1004 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.xtomo_raw(file_name, projections_start = projections_start, projections_end = projections_end, slices_start = slices_start, slices_end = slices_end, white_start = white_start, white_end = white_end, dark_start = dark_start, dark_end = dark_end, projections_digits = 6, log='INFO' ) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center=1026.0 d.gridrec() # Write to stack of TIFFs. mydata = ex.Export() mydata.xtomo_tiff(data = d.data_recon, output_file = 'tmp/APS_1_ID_tiff_2_tomoPy_', axis=0)
def main(): # read a series of tiff # oster: pj: from 0 -> 1440; bf from 0 -> 19; df from 0 -> 19 file_name = '/local/dataraid/databank/PetraIII/2011_KW16_oster/oster02_0001/scan_0002/ccd/pco01/ccd_.tif' dark_file_name = '/local/dataraid/databank/PetraIII/2011_KW16_oster/oster02_0001/scan_0000/ccd/pco01/ccd_.tif' white_file_name = '/local/dataraid/databank/PetraIII/2011_KW16_oster/oster02_0001/scan_0001/ccd/pco01/ccd_.tif' hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/PetraIII_oster02_0001.h5' sample_name = 'PetraIII P06 oster02_0001' projections_start = 0 projections_end = 1441 white_start = 0 white_end = 20 white_step = 1 dark_start = 0 dark_end = 20 dark_step = 1 # to reconstruct slices from slices_start to slices_end # if omitted all data set is recontructed slices_start = 1001 slices_end = 1501 # mydata = dx.Import() # # Read series of images # data, white, dark, theta = mydata.series_of_images(file_name, # projections_start = projections_start, # projections_end = projections_end, # slices_start = slices_start, # slices_end = slices_end, # #projections_angle_range=360, # white_file_name = white_file_name, # white_start = white_start, # white_end = white_end, # white_step = white_step, # dark_file_name = dark_file_name, # dark_start = dark_start, # dark_end = dark_end, # dark_step = dark_step, # sample_name = sample_name, # projections_digits = 4, # projections_zeros = True, # log='INFO' # ) # if you have already created a data exchange file using convert_PetraIII.py module, # comment the call above and read the data set as data exchange using: # Read HDF5 file. data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, slices_start=slices_start, slices_end=slices_end ) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() d.phase_retrieval(pixel_size=0.9e-4, dist=6.9, energy=15.25) #d.correct_drift() d.center=1872.87890625 d.gridrec() # Write to stack of TIFFs. # tomopy.xtomo_writer(d.data_recon, 'tmp/oster02_0001_', axis=0) tomopy.xtomo_writer(d.data_recon, 'tmp/oster02_0001_int_', axis=0, x_start = 1001, overwrite=True, dtype='uint8', data_min=-0.0001, data_max=0.0003)
def main(): # read a series of tiff file_name = '/local/dataraid/databank/VirginiaTech/test_sample_Diplo_4/Diplodocus_1_200mm_4_.tif' dark_file_name = '/local/dataraid/databank/VirginiaTech/test_sample_Diplo_4/Diplodocus_1_200mm_4postDark_.tif' white_file_name = '/local/dataraid/databank/VirginiaTech/test_sample_Diplo_4/Diplodocus_1_200mm_4postFlat_.tif' hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/VirginiaTech_test.h5' sample_name = 'Diplodocus_1_200mm_' projections_start = 1 # projection 0 is dark so we skip it projections_end = 1500 white_start = 0 white_end = 10 white_step = 1 dark_start = 0 dark_end = 10 dark_step = 1 # to reconstruct slices from slices_start to slices_end # if omitted all data set is recontructed slices_start = 600 slices_end = 604 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.series_of_images(file_name, projections_start = projections_start, projections_end = projections_end, slices_start = slices_start, slices_end = slices_end, white_file_name = white_file_name, white_start = white_start, white_end = white_end, white_step = white_step, dark_file_name = dark_file_name, dark_start = dark_start, dark_end = dark_end, dark_step = dark_step, sample_name = sample_name, projections_digits = 5, projections_zeros = True, log='INFO' ) ## # if you have already created a data exchange file using convert_SLS.py module, ## # comment the call above and read the data set as data exchange ## # Read HDF5 file. ## data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, ## slices_start=0, ## slices_end=2) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() #d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center=1018.63 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/AAA_VT_', axis=0)
def main(): # read a series of tiff file_name = '/local/dataraid/databank/VirginiaTech/test_sample_Diplo_4/Diplodocus_1_200mm_4_.tif' dark_file_name = '/local/dataraid/databank/VirginiaTech/test_sample_Diplo_4/Diplodocus_1_200mm_4postDark_.tif' white_file_name = '/local/dataraid/databank/VirginiaTech/test_sample_Diplo_4/Diplodocus_1_200mm_4postFlat_.tif' hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/VirginiaTech_test.h5' sample_name = 'Diplodocus_1_200mm_' projections_start = 1 # projection 0 is dark so we skip it projections_end = 1500 white_start = 0 white_end = 10 white_step = 1 dark_start = 0 dark_end = 10 dark_step = 1 # to reconstruct slices from slices_start to slices_end # if omitted all data set is recontructed slices_start = 600 slices_end = 604 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.series_of_images( file_name, projections_start=projections_start, projections_end=projections_end, slices_start=slices_start, slices_end=slices_end, white_file_name=white_file_name, white_start=white_start, white_end=white_end, white_step=white_step, dark_file_name=dark_file_name, dark_start=dark_start, dark_end=dark_end, dark_step=dark_step, sample_name=sample_name, projections_digits=5, projections_zeros=True, log='INFO') ## # if you have already created a data exchange file using convert_SLS.py module, ## # comment the call above and read the data set as data exchange ## # Read HDF5 file. ## data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, ## slices_start=0, ## slices_end=2) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() #d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center = 1018.63 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/AAA_VT_', axis=0)
def main(): # read a series of tiff file_name = '/local/dataraid/databank/Anka/radios/image_.tif' dark_file_name = '/local/dataraid/databank/Anka/darks/image_.tif' white_file_name = '/local/dataraid/databank/Anka/flats/image_.tif' hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/Anka_test.h5' projections_start = 0 projections_end = 3167 white_start = 0 white_end = 100 dark_start = 0 dark_end = 100 sample_name = 'Anka' # to reconstruct slices from slices_start to slices_end # if omitted all data set is recontructed slices_start = 800 slices_end = 804 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.series_of_images( file_name, projections_start=projections_start, projections_end=projections_end, slices_start=slices_start, slices_end=slices_end, white_file_name=white_file_name, white_start=white_start, white_end=white_end, dark_file_name=dark_file_name, dark_start=dark_start, dark_end=dark_end, sample_name=sample_name, projections_digits=5, log='INFO') ## # if you have already created a data exchange file using convert_SLS.py module, ## # comment the call above and read the data set as data exchange ## # Read HDF5 file. ## data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, ## slices_start=0, ## slices_end=2) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() d.optimize_center() #d.phase_retrieval() #d.correct_drift() #d.center=1010.0 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/ANKA_', axis=0)
def main(): # read a series of tiff file_name = '/local/dataraid/databank/Elettra/Volcanic_rock/tomo_.tif' dark_file_name = '/local/dataraid/databank/Elettra/Volcanic_rock/dark_.tif' white_file_name = '/local/dataraid/databank/Elettra/Volcanic_rock/flat_.tif' hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/Elettra_test.h5' projections_start = 1 projections_end = 1441 white_start = 1 white_end = 11 white_step = 1 dark_start = 1 dark_end = 11 dark_step = 1 sample_name = 'Volcanic_rock' # to reconstruct slices from slices_start to slices_end # if omitted all data set is recontructed slices_start = 150 slices_end = 154 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.series_of_images( file_name, projections_start=projections_start, projections_end=projections_end, projections_digits=4, slices_start=slices_start, slices_end=slices_end, white_file_name=white_file_name, white_start=white_start, white_end=white_end, white_step=white_step, dark_file_name=dark_file_name, dark_start=dark_start, dark_end=dark_end, dark_step=dark_step, data_type='compressed_tiff', # comment this line if regular tiff projections_zeros=True, white_zeros=False, dark_zeros=False, sample_name=sample_name, log='INFO') ## # if you have already created a data exchange file using convert_SLS.py module, ## # comment the call above and read the data set as data exchange ## # Read HDF5 file. ## data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, ## slices_start=0, ## slices_end=2) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() d.optimize_center() #d.phase_retrieval() #d.correct_drift() #d.center=1010.0 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/Elettra_', axis=0)
def main(): # read a series of tiff file_name = '/local/dataraid/databank/AS/Mayo_tooth_AS/SAMPLE_T_.tif' dark_file_name = '/local/dataraid/databank/AS/Mayo_tooth_AS/DF__AFTER_.tif' white_file_name = '/local/dataraid/databank/AS/Mayo_tooth_AS/BG__BEFORE_.tif' hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/Australian_test.h5' sample_name = 'Teeth' projections_start = 0 projections_end = 1801 white_start = 0 white_end = 10 white_step = 1 dark_start = 0 dark_end = 10 dark_step = 1 # to reconstruct slices from slices_start to slices_end # if omitted all data set is recontructed slices_start = 290 slices_end = 294 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.series_of_images(file_name, projections_start = projections_start, projections_end = projections_end, slices_start = slices_start, slices_end = slices_end, white_file_name = white_file_name, white_start = white_start, white_end = white_end, white_step = white_step, dark_file_name = dark_file_name, dark_start = dark_start, dark_end = dark_end, dark_step = dark_step, sample_name = sample_name, projections_digits = 4, white_digits = 2, dark_digits = 2, projections_zeros = True, log='INFO' ) ## # if you have already created a data exchange file using convert_SLS.py module, ## # comment the call above and read the data set as data exchange ## # Read HDF5 file. ## data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, ## slices_start=0, ## slices_end=2) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() d.optimize_center() #d.phase_retrieval() #d.correct_drift() #d.center=1010.0 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/AS_', axis=0)
def main(): # read a series of tiff file_name = '/local/dataraid/databank/SLS_2011/Hornby_SLS/Hornby_b.tif' log_file = '/local/dataraid/databank/SLS_2011/Hornby_SLS/Hornby.log' hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/Hornby_SLS_2011_01.h5' #Read SLS log file data file = open(log_file, 'r') for line in file: linelist = line.split() if len(linelist) > 1: if (linelist[0] == "Number" and linelist[2] == "darks"): number_of_darks = int(linelist[4]) elif (linelist[0] == "Number" and linelist[2] == "flats"): number_of_flats = int(linelist[4]) elif (linelist[0] == "Number" and linelist[2] == "projections"): number_of_projections = int(linelist[4]) elif (linelist[0] == "Rot" and linelist[2] == "min"): rotation_min = float(linelist[6]) elif (linelist[0] == "Rot" and linelist[2] == "max"): rotation_max = float(linelist[6]) elif (linelist[0] == "Angular" and linelist[1] == "step"): angular_step = float(linelist[4]) file.close() dark_start = 1 dark_end = number_of_darks + 1 white_start = dark_end white_end = white_start + number_of_flats projections_start = white_end projections_end = projections_start + number_of_projections # to reconstruct a subset of slices set slices_start and slices_end # if omitted the full data set is recontructed slices_start = 800 slices_end = 804 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.series_of_images( file_name, projections_start=projections_start, projections_end=projections_end, projections_digits=4, slices_start=slices_start, slices_end=slices_end, white_start=white_start, white_end=white_end, dark_start=dark_start, dark_end=dark_end, log='INFO') ## # if you have already created a data exchange file using convert_SLS.py module, ## # comment the call above and read the data set as data exchange ## # Read HDF5 file. ## data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, ## slices_start=0, ## slices_end=2) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center = 1010.0 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/SLS_', axis=0)
def main(): # read a series of tiff file_name = '/local/dataraid/databank/AS/Mayo_tooth_AS/SAMPLE_T_.tif' dark_file_name = '/local/dataraid/databank/AS/Mayo_tooth_AS/DF__AFTER_01.tif' white_file_name = '/local/dataraid/databank/AS/Mayo_tooth_AS/BG__BEFORE_01.tif' hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/Australian_test.h5' sample_name = 'Teeth' projections_start = 0 projections_end = 1801 white_start = 0 white_end = 10 white_step = 1 dark_start = 0 dark_end = 10 dark_step = 1 # to reconstruct slices from slices_start to slices_end # if omitted all data set is recontructed slices_start = 290 slices_end = 294 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.series_of_images( file_name, projections_start=projections_start, projections_end=projections_end, slices_start=slices_start, slices_end=slices_end, white_file_name=white_file_name, white_start=white_start, white_end=white_end, white_step=white_step, dark_file_name=dark_file_name, dark_start=dark_start, dark_end=dark_end, dark_step=dark_step, sample_name=sample_name, projections_digits=4, white_digits=2, dark_digits=2, projections_zeros=True, log='INFO') ## # if you have already created a data exchange file using convert_SLS.py module, ## # comment the call above and read the data set as data exchange ## # Read HDF5 file. ## data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, ## slices_start=0, ## slices_end=2) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center = 1184.0 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/AS_', axis=0)
def main(): # read a series of tiff # oster: pj: from 0 -> 1440; bf from 0 -> 19; df from 0 -> 19 file_name = '/local/dataraid/databank/PetraIII/2011_KW16_oster/oster02_0001/scan_0002/ccd/pco01/ccd_.tif' dark_file_name = '/local/dataraid/databank/PetraIII/2011_KW16_oster/oster02_0001/scan_0000/ccd/pco01/ccd_.tif' white_file_name = '/local/dataraid/databank/PetraIII/2011_KW16_oster/oster02_0001/scan_0001/ccd/pco01/ccd_.tif' hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/PetraIII_oster02_0001.h5' sample_name = 'PetraIII P06 oster02_0001' projections_start = 0 projections_end = 1441 white_start = 0 white_end = 20 white_step = 1 dark_start = 0 dark_end = 20 dark_step = 1 # to reconstruct slices from slices_start to slices_end # if omitted all data set is recontructed slices_start = 1001 slices_end = 1501 # mydata = dx.Import() # # Read series of images # data, white, dark, theta = mydata.series_of_images(file_name, # projections_start = projections_start, # projections_end = projections_end, # slices_start = slices_start, # slices_end = slices_end, # #projections_angle_range=360, # white_file_name = white_file_name, # white_start = white_start, # white_end = white_end, # white_step = white_step, # dark_file_name = dark_file_name, # dark_start = dark_start, # dark_end = dark_end, # dark_step = dark_step, # sample_name = sample_name, # projections_digits = 4, # projections_zeros = True, # log='INFO' # ) # if you have already created a data exchange file using convert_PetraIII.py module, # comment the call above and read the data set as data exchange using: # Read HDF5 file. data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, slices_start=slices_start, slices_end=slices_end) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() d.phase_retrieval(pixel_size=0.9e-4, dist=6.9, energy=15.25) #d.correct_drift() d.center = 1872.87890625 d.gridrec() # Write to stack of TIFFs. # tomopy.xtomo_writer(d.data_recon, 'tmp/oster02_0001_', axis=0) tomopy.xtomo_writer(d.data_recon, 'tmp/oster02_0001_int_', axis=0, x_start=1001, overwrite=True, dtype='uint8', data_min=-0.0001, data_max=0.0003)
def main(): file_name = '/local/dataraid/databank/als/data/raw/sacarroll/20140731_001306_2477A_x00y08/20140731_001306_2477A_x00y08_0000_.tif' dark_file_name = '/local/dataraid/databank/als/data/raw/sacarroll/20140731_001306_2477A_x00y08/20140731_001306_2477A_x00y08drk_.tif' white_file_name = '/local/dataraid/databank/als/data/raw/sacarroll/20140731_001306_2477A_x00y08/20140731_001306_2477A_x00y08bak_.tif' log_file = '/local/dataraid/databank/als/data/raw/sacarroll/20140731_001306_2477A_x00y08/20140731_001306_2477A_x00y08.sct' verbose = True # Read ALS log file data file = open(log_file, 'r') for line in file: if '-scanner' in line: Source = re.sub(r'-scanner ', "", line) if verbose: print 'Facility', Source if '-object' in line: Sample = re.sub(r'-object ', "", line) if verbose: print 'Sample', Sample if '-senergy' in line: Energy = re.findall(r'\d+.\d+', line) if verbose: print 'Energy', Energy[0] if '-scurrent' in line: Current = re.findall(r'\d+.\d+', line) if verbose: print 'Current', Current[0] if '-nangles' in line: Angles = re.findall(r'\d+', line) if verbose: print 'Angles', Angles[0] if '-num_bright_field' in line: WhiteEnd = re.findall(r'\d+', line) if '-num_dark_fields' in line: DarkEnd = re.findall(r'\d+', line) file.close() dark_start = 0 dark_end = int(DarkEnd[0]) dark_step = 1 white_start = 0 white_end = int(WhiteEnd[0]) white_step = 1 projections_start = 0 projections_end = int(Angles[0]) # set to convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 245 slices_end = 249 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.xtomo_raw( file_name=file_name, projections_start=projections_start, projections_end=projections_end, slices_start=slices_start, slices_end=slices_end, white_file_name=white_file_name, white_start=white_start, white_end=white_end, dark_file_name=dark_file_name, dark_start=dark_start, dark_end=dark_end, projections_digits=4, log='INFO') # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() d.center = 1282.5 d.gridrec() # Write to stack of TIFFs. mydata = ex.Export() mydata.xtomo_tiff(data=d.data_recon, output_file='tmp/ALS_tiff_2_tomoPy_', axis=0)
def main(): file_name = '/local/dataraid/databank/APS_1_ID/APS1ID_Cat4B_2/CAT4B_2_.tif' log_file = '/local/dataraid/databank/APS_1_ID/APS1ID_Cat4B_2/CAT4B_2_TomoStillScan.dat' #Read APS 1-ID log file data file = open(log_file, 'r') for line in file: linelist = line.split() if len(linelist) > 1: if (linelist[0] == "First" and linelist[1] == "image"): projections_start = int(linelist[4]) elif (linelist[0] == "Last" and linelist[1] == "image"): projections_end = int(linelist[4]) elif (linelist[0] == "Dark" and linelist[1] == "field"): dark_start = int(linelist[6]) elif (linelist[0] == "Number" and linelist[2] == "dark"): number_of_dark = int(linelist[5]) elif (linelist[0] == "White" and linelist[1] == "field"): white_start = int(linelist[6]) elif (linelist[0] == "Number" and linelist[2] == "white"): number_of_white = int(linelist[5]) file.close() dark_end = dark_start + number_of_dark white_end = white_start + number_of_white # to fix a data collection looging bug ? white_start = white_start + 1 dark_start = dark_start + 1 projections_start = projections_start + 11 projections_end = projections_end - 9 ## # these are correct per Peter discussion ## projections_start = 943 ## projections_end = 1853 ## white_start = 1844 ## white_end = 1853 ## dark_start = 1854 ## dark_end = 1863 # set to convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 1000 slices_end = 1004 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.xtomo_raw( file_name, projections_start=projections_start, projections_end=projections_end, slices_start=slices_start, slices_end=slices_end, white_start=white_start, white_end=white_end, dark_start=dark_start, dark_end=dark_end, projections_digits=6, log='INFO') # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center = 1026.0 d.gridrec() # Write to stack of TIFFs. mydata = ex.Export() mydata.xtomo_tiff(data=d.data_recon, output_file='tmp/APS_1_ID_tiff_2_tomoPy_', axis=0)
def run(self): data_orig, theta, channelname = xtomo_reader_gui(self.h5files) writetxt(channelname) projections = len(self.h5files) diff = array( [-4, 5, 8, 4, 3, -3, -10, -10, -7, 3, 1, 6, 6, 4, 0, 1, 3, 0, -9], dtype=int32) #diff=diff[int(projections_start)-172:int(projections_end)-172+1] element = zeros(1) element[0] = 7 count = element.shape[0] for numb in arange(count): elem = element[numb] data = data_orig[elem, :, :, :] for i in arange(projections): olddata = data[i, :, :] data[i, :, :] = np.roll(olddata[:, :], diff[i], axis=1) sino = sinogram(data) if sinogramsave == True: j = Image.fromarray(sino.astype(np.float32)) try: j.save(os.getcwd() + "/sinogram/" + channelname[elem] + "_sinogram.tiff") print "saving sinogram... " print os.getcwd( ) + "/sinogram/" + channelname[elem] + "_sinogram.tiff" except IOError: os.mkdir(os.getcwd() + "/sinogram") j.save(os.getcwd() + "/sinogram/" + channelname[elem] + "_sinogram.tiff") print "saving sinogram... " print os.getcwd( ) + "/sinogram/" + channelname[elem] + "_sinogram.tiff" #data=np.expand_dims(data[:,25,:],axis=1) # Xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') data[data == inf] = 1 d.dataset(data, theta=theta * np.pi / 180) d.center = 959 print reconstructiontype, channelname[elem] if reconstructiontype == "mlem": d.mlem() if reconstructiontype == "art": d.art() if reconstructiontype == "gridrec": d.gridrec() xtomo_writer_f(d.data_recon, 'tmp/' + str(channelname[elem]) + '/' + reconstructiontype + '/test_' + str(d.center), axis=0)
for i in arange(projections): olddata=data[i,:,:] data[i,:,:]=np.roll(olddata[:,:],diff[i],axis=1) sino=sinogram(data) if sinogramsave==True: j=Image.fromarray(sino.astype(np.float32)) try: j.save(os.getcwd()+"/sinogram/"+channelname[elem]+"_sinogram.tiff") except IOError: os.mkdir(os.getcwd()+"/sinogram") j.save(os.getcwd()+"/sinogram/"+channelname[elem]+"_sinogram.tiff") #data=np.expand_dims(data[:,25,:],axis=1) # Xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') data[data == inf] = 1 d.dataset(data, theta=theta*np.pi/180) #print d.data.shape #tomopy.xtomo_writer(d.data, 'tmp/test_', axis=1, overwrite=True) #d.normalize() #d.correct_drift() #d.phase_retrieval() #d.data = (np.exp(-0.0001*d.data)).astype('float32') #d.correct_drift() #tomopy.xtomo_writer(d.data, 'tmp/test_', axis=1, overwrite=True) #d.data[d.data is np.nan]=1. #whereAreNaNs = np.isnan(d.data) #d.data[whereAreNaNs] = 1. #print d.data
def main(): file_name = '/local/dataraid/databank/APS_1_ID/APS1ID_Cat4B_2/CAT4B_2_.tif' log_file = '/local/dataraid/databank/APS_1_ID/APS1ID_Cat4B_2/CAT4B_2_TomoStillScan.dat' hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/CAT4B_2_test_01.h5' #Read APS 1-ID log file data file = open(log_file, 'r') for line in file: linelist = line.split() if len(linelist) > 1: if (linelist[0] == "First" and linelist[1] == "image"): projections_start = int(linelist[4]) elif (linelist[0] == "Last" and linelist[1] == "image"): projections_end = int(linelist[4]) elif (linelist[0] == "Dark" and linelist[1] == "field"): dark_start = int(linelist[6]) elif (linelist[0] == "Number" and linelist[2] == "dark"): number_of_dark = int(linelist[5]) elif (linelist[0] == "White" and linelist[1] == "field"): white_start = int(linelist[6]) elif (linelist[0] == "Number" and linelist[2] == "white"): number_of_white = int(linelist[5]) file.close() dark_end = dark_start + number_of_dark white_end = white_start + number_of_white # to fix a data collection looging bug ? white_start = white_start + 1 dark_start = dark_start + 1 projections_start = projections_start + 11 projections_end = projections_end - 9 ## # these are correct per Peter discussion ## projections_start = 943 ## projections_end = 1853 ## white_start = 1844 ## white_end = 1853 ## dark_start = 1854 ## dark_end = 1863 print projections_start, projections_end print dark_start, dark_end print white_start, white_end # set to convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 1000 slices_end = 1004 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.series_of_images( file_name, projections_start=projections_start, projections_end=projections_end, slices_start=slices_start, slices_end=slices_end, white_start=white_start, white_end=white_end, dark_start=dark_start, dark_end=dark_end, projections_digits=6, log='INFO') ## # if you have already created a data exchange file using convert_SLS.py module, ## # comment the call above and read the data set as data exchange ## # Read HDF5 file. ## data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, ## slices_start=0, ## slices_end=2) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center = 1026.0 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/APS_1ID_', axis=0)
def main(): # read a series of tiff file_name = '/local/dataraid/databank/ALS_2011/Blakely/blakely_raw/blakelyALS_.tif' dark_file_name = '/local/dataraid/databank/ALS_2011/Blakely/blakely_raw/blakelyALSdrk_.tif' white_file_name = '/local/dataraid/databank/ALS_2011/Blakely/blakely_raw/blakelyALSbak_.tif' log_file = '/local/dataraid/databank/ALS_2011/Blakely/blakely_raw/blakelyALS.sct' hdf5_file_name = '/local/dataraid/databank/dataExchange/tmp/blakely_ALS_2011_test.h5' verbose = True # Read ALS log file data file = open(log_file, 'r') for line in file: if '-scanner' in line: Source = re.sub(r'-scanner ', "", line) if verbose: print 'Facility', Source if '-object' in line: Sample = re.sub(r'-object ', "", line) if verbose: print 'Sample', Sample if '-senergy' in line: Energy = re.findall(r'\d+.\d+', line) if verbose: print 'Energy', Energy[0] if '-scurrent' in line: Current = re.findall(r'\d+.\d+', line) if verbose: print 'Current', Current[0] if '-nangles' in line: Angles = re.findall(r'\d+', line) if verbose: print 'Angles', Angles[0] if '-i0cycle' in line: WhiteStep = re.findall(r'\s+\d+', line) if verbose: print 'White Step', WhiteStep[0] file.close() dark_start = 0 dark_end = 20 dark_step = 1 white_start = 0 white_end = int(Angles[0]) white_step = int(WhiteStep[0]) projections_start = 0 projections_end = int(Angles[0]) # to reconstruct a subset of slices set slices_start and slices_end # if omitted the full data set is recontructed slices_start = 800 slices_end = 804 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.series_of_images(file_name = file_name, projections_start = projections_start, projections_end = projections_end, slices_start = slices_start, slices_end = slices_end, white_file_name = white_file_name, white_start = white_start, white_end = white_end, white_step = white_step, dark_file_name = dark_file_name, dark_start = dark_start, dark_end = dark_end, dark_step = dark_step, projections_zeros = False, white_zeros = False, dark_zeros = False, log='INFO' ) ## # if you have already created a data exchange file using convert_SLS.py module, ## # comment the call above and read the data set as data exchange ## # Read HDF5 file. ## data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, ## slices_start=0, ## slices_end=2) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center=1683.8 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/ALS_', axis=0)
def main(): file_name = '/local/dataraid/databank/APS_1_ID/APS1ID_Cat4B_2/CAT4B_2_.tif' log_file = '/local/dataraid/databank/APS_1_ID/APS1ID_Cat4B_2/CAT4B_2_TomoStillScan.dat' hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/CAT4B_2_test_01.h5' #Read APS 1-ID log file data file = open(log_file, 'r') for line in file: linelist=line.split() if len(linelist)>1: if (linelist[0]=="First" and linelist[1]=="image"): projections_start = int(linelist[4]) elif (linelist[0]=="Last" and linelist[1]=="image"): projections_end = int(linelist[4]) elif (linelist[0]=="Dark" and linelist[1]=="field"): dark_start = int(linelist[6]) elif (linelist[0]=="Number" and linelist[2]=="dark"): number_of_dark = int(linelist[5]) elif (linelist[0]=="White" and linelist[1]=="field"): white_start = int(linelist[6]) elif (linelist[0]=="Number" and linelist[2]=="white"): number_of_white = int(linelist[5]) file.close() dark_end = dark_start + number_of_dark white_end = white_start + number_of_white # to fix a data collection looging bug ? white_start = white_start + 1 dark_start = dark_start +1 projections_start = projections_start + 11 projections_end = projections_end - 9 ## # these are correct per Peter discussion ## projections_start = 943 ## projections_end = 1853 ## white_start = 1844 ## white_end = 1853 ## dark_start = 1854 ## dark_end = 1863 print projections_start, projections_end print dark_start, dark_end print white_start, white_end # set to convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 1000 slices_end = 1004 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.series_of_images(file_name, projections_start = projections_start, projections_end = projections_end, slices_start = slices_start, slices_end = slices_end, white_start = white_start, white_end = white_end, dark_start = dark_start, dark_end = dark_end, projections_digits = 6, log='INFO' ) ## # if you have already created a data exchange file using convert_SLS.py module, ## # comment the call above and read the data set as data exchange ## # Read HDF5 file. ## data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, ## slices_start=0, ## slices_end=2) # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center=1026.0 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/APS_1ID_', axis=0)
def main(): file_name = '/local/dataraid/databank/als/data/raw/sacarroll/20140731_001306_2477A_x00y08/20140731_001306_2477A_x00y08_0000_.tif' dark_file_name = '/local/dataraid/databank/als/data/raw/sacarroll/20140731_001306_2477A_x00y08/20140731_001306_2477A_x00y08drk_.tif' white_file_name = '/local/dataraid/databank/als/data/raw/sacarroll/20140731_001306_2477A_x00y08/20140731_001306_2477A_x00y08bak_.tif' log_file = '/local/dataraid/databank/als/data/raw/sacarroll/20140731_001306_2477A_x00y08/20140731_001306_2477A_x00y08.sct' hdf5_file_name = '/local/dataraid/databank/dataExchange/microCT/ALS_20140731.h5' verbose = True # start = time.clock() # Read ALS log file data file = open(log_file, 'r') for line in file: if '-scanner' in line: Source = re.sub(r'-scanner ', "", line) if verbose: print 'Facility', Source if '-object' in line: Sample = re.sub(r'-object ', "", line) if verbose: print 'Sample', Sample if '-senergy' in line: Energy = re.findall(r'\d+.\d+', line) if verbose: print 'Energy', Energy[0] if '-scurrent' in line: Current = re.findall(r'\d+.\d+', line) if verbose: print 'Current', Current[0] if '-nangles' in line: Angles = re.findall(r'\d+', line) if verbose: print 'Angles', Angles[0] if '-i0cycle' in line: WhiteStep = re.findall(r'\s+\d+', line) if verbose: print 'White Step', WhiteStep[0] if '-num_bright_field' in line: WhiteEnd = re.findall(r'\d+', line) if '-num_dark_fields' in line: DarkEnd = re.findall(r'\d+', line) file.close() dark_start = 0 dark_end = int(DarkEnd[0]) dark_step = 1 white_start = 0 white_end = int(WhiteEnd[0]) white_step = int(WhiteStep[0]) projections_start = 0 projections_end = int(Angles[0]) # set to convert slices between slices_start and slices_end # if omitted all data set will be converted slices_start = 245 slices_end = 265 # mydata = dx.Import() # Read series of images # data, white, dark, theta = mydata.series_of_images(file_name = file_name, # projections_start = projections_start, # projections_end = projections_end, ## slices_start = slices_start, ## slices_end = slices_end, # white_file_name = white_file_name, # white_start = white_start, # white_end = white_end, # dark_file_name = dark_file_name, # dark_start = dark_start, # dark_end = dark_end, # projections_digits = 4, # log='INFO' # ) start = time.clock() # if you have already created a data exchange file using convert_SLS.py module, # comment the call above and read the data set as data exchange # Read HDF5 file. data, white, dark, theta = tomopy.xtomo_reader(hdf5_file_name, slices_start=slices_start, slices_end=slices_end) elapsed = (time.clock() - start) print "Total Time to read raw files:", elapsed # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center=1282.5 d.gridrec() # Write to stack of TIFFs. tomopy.xtomo_writer(d.data_recon, 'tmp/ALS_new', axis=0)
def main(): log_file = '/local/dataraid/databank/Sangid/Sam01/Sam01_exp.hdf' #Read APS 2-BM log file data f = SD.SD(log_file) sds = f.select('base_name') data = sds.get() base_name = ''.join(data) print base_name file_name = os.path.split( log_file)[0] + "/" + "raw" + "/" + base_name + "_.hdf" sds = f.select('start_angle') start_angle = sds.get()[0] sds = f.select('end_angle') end_angle = sds.get()[0] sds = f.select('angle_interval') angle_interval = sds.get()[0] sds = f.select('num_dark_fields') num_dark_fields = sds.get()[0] f.end() white_start = 1 white_end = 2 projections_start = 2 projections_end = projections_start + (int)( (end_angle - start_angle) / angle_interval) + 1 dark_start = projections_end + 1 dark_end = dark_start + num_dark_fields sample_name = base_name # to reconstruct a subset of slices set slices_start and slices_end # if omitted the full data set is recontructed slices_start = 1365 slices_end = 1369 mydata = dx.Import() # Read series of images data, white, dark, theta = mydata.xtomo_raw( file_name, projections_start=projections_start, projections_end=projections_end, slices_start=slices_start, slices_end=slices_end, white_start=white_start, white_end=white_end, dark_start=dark_start, dark_end=dark_end, projections_digits=5, data_type='hdf4', log='INFO') # TomoPy xtomo object creation and pipeline of methods. d = tomopy.xtomo_dataset(log='debug') d.dataset(data, white, dark, theta) d.normalize() d.correct_drift() #d.optimize_center() #d.phase_retrieval() #d.correct_drift() d.center = 1059.2 d.gridrec() # Write to stack of TIFFs. mydata = ex.Export() mydata.xtomo_tiff(data=d.data_recon, output_file='tmp/APS_2_BM_hdf4_2_tomoPy_', axis=0)