예제 #1
0
def main():
    normalized = i3.normalize(ct_series,
                              dfs,
                              obs,
                              workdir=os.path.join(workdir, 'normalization'))
    tilt_corrected = i3.correct_tilt(normalized,
                                     workdir=os.path.join(
                                         workdir, 'tilt-correction'))
    if_corrected = i3.correct_intensity_fluctuation(
        tilt_corrected,
        workdir=os.path.join(workdir, 'intensity-fluctuation-correction'))
    angles, sinograms = i3.build_sinograms(if_corrected,
                                           workdir=os.path.join(
                                               workdir, 'sinogram'))
    # take the middle part to calculate the center of rotation
    sino = [s.data for s in sinograms[900:1100]]
    sino = np.array(sino)
    proj = np.swapaxes(sino, 0, 1)
    rot_center = tomopy.find_center(proj,
                                    theta,
                                    emission=False,
                                    init=1024,
                                    tol=0.5)
    rot_center = rot_center[0]
    # reconstruct
    recon = i3.reconstruct(angles,
                           sinograms,
                           workdir=outdir,
                           center=rot_center)
    return
예제 #2
0
def test():
    normalized = i3.normalize(ct_series, dfs, obs, workdir=workdir)
    tilt_corrected = i3.correct_tilt(normalized, workdir=workdir)
    if_corrected = i3.correct_intensity_fluctuation(tilt_corrected,
                                                    workdir=workdir)
    angles, sinograms = i3.build_sinograms(if_corrected, workdir=workdir)
    recon = i3.reconstruct(angles, sinograms, workdir=outdir)
    return
예제 #3
0
def main():
    normalized = i3.normalize(ct_series, dfs, obs, workdir=os.path.join(workdir, 'normalization'))
    tilt_corrected = i3.correct_tilt(normalized, workdir=os.path.join(workdir, 'tilt-correction'))
    if_corrected = i3.correct_intensity_fluctuation(tilt_corrected, workdir=os.path.join(workdir, 'intensity-fluctuation-correction'))
    angles, sinograms = i3.build_sinograms(if_corrected, workdir=os.path.join(workdir, 'sinogram'))
    # take the middle part to calculate the center of rotation
    sino = [s.data for s in sinograms[900:1100]]
    sino= np.array(sino)
    proj = np.swapaxes(sino, 0, 1)
    rot_center = tomopy.find_center(proj, theta, emission=False, init=1024, tol=0.5)
    rot_center = rot_center[0]
    # reconstruct
    recon = i3.reconstruct(angles, sinograms, workdir=outdir, center=rot_center)
    return
예제 #4
0
 def preprocess(self, workdir=None, outdir=None):
     workdir = workdir or self.workdir
     outdir = outdir or self.outdir
     # get image objs
     dfs = self.dfs; obs = self.obs
     ct_series = self.ct_series
     theta = self.theta
     # preprocess
     gamma_filtered = i3.gamma_filter(
         ct_series, workdir=os.path.join(workdir, 'gamma-filter'),
         parallel = self.parallel_preprocessing)
     normalized = i3.normalize(gamma_filtered, dfs, obs, workdir=os.path.join(workdir, 'normalization'))
     if self.clean_on_the_fly:
         gamma_filtered.removeAll()
     if_corrected = i3.correct_intensity_fluctuation(normalized, workdir=os.path.join(workdir, 'intensity-fluctuation-correction'))
     if self.clean_on_the_fly:
         normalized.removeAll()
     return if_corrected