/tomo/pyhst

To get this branch, use:
bzr branch http://darksoft.org/webbzr/tomo/pyhst

« back to all changes in this revision

Viewing changes to PyHST.py

  • Committer: Suren A. Chilingaryan
  • Date: 2017-09-28 10:34:47 UTC
  • Revision ID: csa@suren.me-20170928103447-dggjgnuxmymgew2a
Quality fixes (tex-based)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
import fast_EdfFile
23
23
from FastEdf import extended_fread, extended_fread_2d
24
 
import PIL as Image
 
24
from PIL import Image
25
25
import numpy as Numeric
26
26
 
27
27
import build_config
700
700
      sys.path=[Parameters.SINO_FILTER_PATH] + sys.path
701
701
      exec ("from %s import Filter as SINO_FILTER" % Parameters.SINO_FILTER,locals() , globals() )
702
702
 
703
 
 
 
703
 sino_pos = 0
704
704
 for nsino in range( Parameters.NUM_FIRST_SINOGRAM, Parameters.NUM_LAST_SINOGRAM+1 ):
705
705
    if module_mode:
706
706
        SINO = sys._getframe(1).f_globals['sinograms'][nsino]
737
737
 
738
738
    if(nsino==Parameters.NUM_FIRST_SINOGRAM):
739
739
        name_out=Parameters.OUTPUT_FILE
740
 
        SINOWORK=Numeric.array(SINO)
 
740
        SINOWORK=Numeric.empty([Parameters.NUM_LAST_SINOGRAM - Parameters.NUM_FIRST_SINOGRAM + 1,SINO.shape[1], SINO.shape[2]], dtype="f")
741
741
        start_time = time.time()
742
742
        
743
743
        normalise = Numeric.array([1.0],"f")
744
744
 
745
 
        pyhst=PyHST_c.PyHST( logger, 1, name_out ,
 
745
        pyhst=PyHST_c.PyHST( logger, Parameters.NUM_LAST_SINOGRAM - Parameters.NUM_FIRST_SINOGRAM + 1, name_out ,
746
746
                  Parameters.METHOD,
747
747
                  Parameters.FFT_OVERSAMPLING_FACTOR,
748
748
                  Parameters.DFI_KERNEL_SIZE,
778
778
               -Parameters.NUM_FIRST_SINOGRAM +  Parameters.NUM_LAST_SINOGRAM+1
779
779
              )
780
780
 
781
 
 
782
 
        normalise = Numeric.array([(math.pi / 2.0) * (1.0 /  SINO.shape[1]) *   (1.0e6*0.01 / Parameters.IMAGE_PIXEL_SIZE_1)],"f")
 
781
        if pyhst.astra_scaling:
 
782
            normalise = Numeric.array([ (1.0e6*0.01 / Parameters.IMAGE_PIXEL_SIZE_1)],"f")
 
783
        else:
 
784
            normalise = Numeric.array([(math.pi / 2.0) * (1.0 /  SINO.shape[1]) *   (1.0e6*0.01 / Parameters.IMAGE_PIXEL_SIZE_1)],"f")
783
785
        logger.debug(" # " * 80)
784
786
        logger.debug(" LE FACTEUR DE NORMALISATION EST %s" , normalise)
785
787
        logger.debug(" # " * 80)
786
788
    if( Parameters.DO_SINO_FILTER ):
787
789
       SINO_FILTER(SINO,    Parameters.SINO_FILTER_PARA  )
788
790
 
789
 
    SINOWORK[:,:,:] =SINO*normalise 
790
 
    
791
 
    start_time = time.time()
792
 
    pyhst.calcSlices(1 ,Parameters.OPTIONS)
793
 
    c_timer += time.time() - start_time
 
791
    SINOWORK[sino_pos,:,:] =SINO[0,:,:] * normalise 
 
792
    sino_pos += 1
 
793
 
 
794
 
 
795
 start_time = time.time()
 
796
 pyhst.calcSlices(sino_pos ,Parameters.OPTIONS)
 
797
 c_timer += time.time() - start_time
794
798
 
795
799
else:
796
800