CARS Tomography Routines

This page was created by the IDL library routine mk_html_help. For more information on this routine, refer to the IDL Online Help Navigator or type:

     ? mk_html_help

at the IDL command line prompt.

Last modified: Sun Nov 26 12:57:35 2023.


List of Routines


Routine Descriptions

READ_TOMO_VOLUME

[Next Routine] [List of Routines]
 NAME:
   READ_TOMO_VOLUME

 PURPOSE:
   Reads in 3-D volume files written by WRITE_TOMO_VOLUME or TOMO::WRITE_VOLUME.
   This function is a simple wrapper around TOMO::READ_VOLUME.
   See the documentation for TOMO::READ_VOLUME 
   for information on the input parameters and other details.

 PROCEDURE:
   This function simply creates a TOMO object and calls TOMO::READ_VOLUME.

(See read_tomo_volume.pro)


TOMO::BACKPROJECT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   TOMO::BACKPROJECT

 PURPOSE:
   Reconstructs a sinogram into an image using backprojection.

 CALLING SEQUENCE:
   Result = BACKPROJECT(SINOGRAM, CENTER=CENTER)

 INPUTS:
   SINOGRAM:
     The input sinogram, dimensions NX x NANGLES.  
     This should have been filtered before calling this function.
     It is typically created with TOMO::SINOGRAM

 KEYWORD PARAMETERS
   CENTER:
     The rotation center to use when reconstructing.  Default is the center of the sinogram.
     
 OUTPUTS:
   This function returns the reconstructed image.

 PROCEDURE:
   This function calls either the IDL RIEMANN or RADON procedure depending on the value of self.BP_Method.
   These procedures are called with the BACKPROJECT keyword.
   With RIEMANN interpolation can be None, Bilinear or Cubic depending on the value of self.RiemannInterpolation.
   With RADON interpolation can be None or Linear, depending on the value of self.RadonInterpolation.

(See tomo__define.pro)


TOMO::CORRECT_ROTATION_TILT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  TOMO::CORRECT_ROTATION_TILT

 PURPOSE:
   This procedure rotates each projection by the specified angle.
   It can be used to correct for the rotation axis not being parallel to the columns of the camera.

 CALLING SEQUENCE:
   TOMO->CORRECT_ROTATION_TILT, ANGLE

 INPUT PARAMETERS:
   ANGLE (required)
     The angle in degrees clockwise by which to rotate each projection.

; PROCEDURE:
   Uses the IDL ROT function.  self.pVolume is modified in place.

(See tomo__define.pro)


TOMO::FILTER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   TOMO::FILTER

 PURPOSE:
   Filters a sinogram before backprojection.  A selection of filters is
   available.

 CALLING SEQUENCE:
   Result = TOMO->FILTER(SINOGRAM, FILTER_SIZE, D)

 INPUTS:
   SINOGRAM:
     The unfiltered sinogram.  This must be a 2-D array.

 OPTIONAL INPUTS:
   FILTER_SIZE:
     The half-size of the filter in pixels.
     The default is NX/4 where NX is the first dimension of the sinogram.

   D:
     An additional filter parameter.  The default is 1.0

 KEYWORD PARAMETERS:
   FILTER_NAME:
     A case-insensitive string specifying the filter to be used.
     Allowed values are:
       'GEN_HAMMING'
       'LP_COSINE'
       'SHEPP_LOGAN'
       'RAMLAK'
       'NONE'
       The default is 'SHEPP_LOGAN'

 OUTPUTS:
   This function returns the filtered sinogram.

 PROCEDURE:
   For each row in the sinogram, this function simply does the following:
       Pads the input sinogram
       Does a convolution with the appropriate filter
   The code for the filters was taken from the IDL tomography demo program
   which is included in the IDL distribution.  It would be easy to add
   additional filters in the future.

(See tomo__define.pro)


TOMO::GET_STRUCT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   TOMO::GET_STRUCT

 PURPOSE:
   This function returns the member variables of the tomo class as a structure
   It is provided because IDL class member variables are always private.

 CALLING SEQUENCE:
   result = TOMO->GET_STRUCT()

 RETURN VALUE:
   Returns the tomo object member variables as a structure.

(See tomo__define.pro)


TOMO::GET_VOLUME

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   TOMO::GET_VOLUME

 PURPOSE:
   This function returns self.pVolume.
   This is a pointer to raw, normalized, or reconstructed data, depending on the most recent operation performed.
   It is an IDL pointer, so calling this function does not result in a copy operation.

 CALLING SEQUENCE:
   result = TOMO->GET_VOLUME()

 RETURN VALUE:
   Returns self.pVolume.

(See tomo__define.pro)


TOMO::GRIDREC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   TOMO::GRIDREC

 PURPOSE:
   Performs tomographic reconstruction using the "gridrec" algorithm written
   by Bob Marr and Graham Campbell (not sure about authors) at BNL in 1997.
   The basic algorithm is based on FFTs.  It reconstructs 2 sinograms at once,
   one in the real part of the FFT and one in the imaginary part.

   This routine is 20-40 times faster than BACKPROJECT, and yields virtually
   identical reconstructions. 
   It uses CALL_EXTERNAL to call GridrecIDL.c which is a thin wrapper to grid.c

   However, GridrecIDL.c only reconstructs 2 slices, and is single-threaded.
   For fast reconstructions TOMO::TOMO_RECON should be used instead.
   TOMO::TOMO_RECON is much faster bbecause it also computes the sinograms in C++ rather than in IDL
   and it is multithreaded and so reconstructs many slices in parallel.

   TOMO::GRIDREC is typically used only when reconstructing single slices when it is desireable to
   visualize the sinogram and the center-of-gravity plot of the sinogram

 CALLING SEQUENCE:
   TOMO->GRIDREC, SINOGRAM1, SINOGRAM2, IMAGE1, IMAGE2

 INPUTS:
   SINOGRAM1:
       The first input sinogram, dimensions NX x NANGLES.
   SINOGRAM2:
       The second input sinogram, dimensions NX x NANGLES.

 KEYWORD PARAMETERS:
   CENTER: 
     The column containing the rotation axis. The default is the center of the sinogram.

 OUTPUTS:
   IMAGE1:
       The reconstructed image from SINOGRAM1.
   IMAGE2:
       The reconstructed image from SINOGRAM2.

 PROCEDURE:
   This function uses CALL_EXTERNAL to call the shareable library GridrecIDL,
   which is written in C.

(See tomo__define.pro)


TOMO::INIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   TOMO::INIT

 PURPOSE:
   This function is called implicitly when a new TOMO object is created.
   It initializes all member variables to reasonable defaults.

 CALLING SEQUENCE:
   TOMO = OBJ_NEW('TOMO', KEYWORD=VALUE, ...)

 KEYWORD PARAMETERS:
   settingsFile   Name of a settings file previously saved with TOMO::SAVE_SETTINGS
   statusWidget   Widget ID of a status widget. If present, the TOMO methods will write status strings to this widget.
   abortWidget    Widget ID of an abort width.  If present, the TOMO methods monitor this widget to know when to abort operations.
   debugLevel     Debugging level for messages

(See tomo__define.pro)


TOMO::OPTIMIZE_CENTER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  TOMO::OPTIMIZE_CENTER

 PURPOSE:
   This procedure optimizes the rotation center on 2 different slices, typically one near the 
   top of the projections and the other near the bottom.
   TOMO::PREPROCESS must be called before calling this procudure. 

 CALLING SEQUENCE:
   TOMO->OPTIMIZE_CENTER, SLICES, CENTER, MERIT, WIDTH=WIDTH, STEP=STEP, METHOD=METHOD

 INPUT PARAMETERS:
   SLICES (required)
     A 2-element array containing the slice numbers to use for optimization.
     Normally one should be near the top of the projections and the other near the bottom.
   CENTER (required)
     The initial guess of the optimum rotation center.
     
 OUTPUT PARAMETERS:
   MERIT:
     An array of [2, nCenter] where nCenter = WIDTH/STEP + 1. 
     This array contains the figure of merit for each rotation center for the upper and lower slices.  
     The minimum value is nominally the best rotation center.

 KEYWORD PARAMETERS
   WIDTH:
     The full-width of the rotation center search region in pixels. Default=10.
   STEP:
     The step size within the WIDTH for each trial rotation center.  
     Default=0.5 if METHOD='0-180' and 0.25 if METHOD='Entropy'.
   METHOD:
     The optimization method.  Valid choices are '0-180' and 'Entropy'.
     
 PROCEDURE:
   The IDL tomography documentation (https://CARS-UChicago.github.io/IDL_tomography) explains
   the optimization algorithms in detail.
   
   After the optimization the two slice numbers and the minimum values of MERIT are passed
   to TOMO::SET_ROTATION.  That routine sets self.rotationCenter and self.rotationCenterSlope
   which are used to set the rotation center of each slice during reconstruction.

(See tomo__define.pro)


TOMO::PREPROCESS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  TOMO::PREPROCESS

 PURPOSE:
   This procedure performs the preprocessing on a tomography dataset, producing normalized data that
   is corrected for dark fields, flat fields, and zingers.
   The data must have been read into the tomo object with TOMO::READ_CAMERA_FILE.
   The preprocessing parameters can be specified before calling this function with TOMO::SET_PREPROCESS_PARAMS.

 CALLING SEQUENCE:
   TOMO->PREPROCESS

 PROCEDURE:
   This function performs the following steps:
   - Averages the dark fields if there is more than 1.
   - Subtracts the dark current from each flat field field frame,
   - Removes zingers from flat field frames using SELF->REMOVE_ARTIFACTS with
     /DOUBLE_CORRELATION if there is more than 1, or /ZINGERS if there is only 1.
   - Averages the flat fields if there is more than 1.
   - Calls the multithreaded C++ code in tomoRecon to do the following:
     - Subtract the dark current from each projection.
     - Divide each projection by the average flat field.
     - Remove zingers using a median filter with self.zingerWidth and self.zingerThreshold.
     - Scale the normalized projection by self.preprocessScale.
   - Optionally converts the normalized projections to UInt16 if self.preprocessDataType = 'UInt16'.
   - Optionally writes the normalized data frames to a single disk file if self.preprocessWriteOutput is true.
     The file can be written in HDF5 or netCDF format.
   - Replaces the raw data in self.pVolume with the normalized data.

(See tomo__define.pro)


TOMO::READ_CAMERA_FILE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  TOMO::READ_CAMERA_FILE

 PURPOSE:
   This procedure reads a tomography data set from the following types of data files:
     - netCDF files.  These are files collected before July 2020.  There are 4 files
       - base_1.nc contains flat fields collected at the beginning
       - base_2.nc contains the projections
       - base_3.nc contains the flat fields collected at the end
       - base.setup ASCII file containing metadata including the pixel size and dark current.
       
     - HDF5 files.  These are files collected after July 2020.  There are 2 files:
       - base.h5     A single file HDF5 that contains the flat fields, dark fields, projections, and metadata
       - base.config An ASCII file containing metadata. 

 INPUT PARAMETERS:
   FILENAME (required):
     For netCDF this can be the name of any of the 3 netCDF files
     For HDF5 this is the name of the HDF5 file

 PROCEDURE:
   - Reads the data into the tomo object, including these member variables
       nx, ny, nz
       xPixelSize, yPixelSize, zPixelSize
       pAngles
       pFlats
       pDarks
       pData
       rotationCenter       Initialized to nx/2
       rotationCenterSlope  Initialize to 0
  - For netCDF files reads the .setup file with TOMO::READ_SETUP
  - For HDF5 files reads the .config file with TOMO::READ_SAMPLE_CONFIG

(See tomo__define.pro)


TOMO::READ_SAMPLE_CONFIG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   TOMO::READ_SAMPLE_CONFIG

 PURPOSE:
   This procedure reads some of fields in the JSON .config file into tomo object variables.

 CALLING SEQUENCE:
   TOMO->READ_SAMPLE_CONFIG, FILE
   
 INPUTS:
   FILE:  The name of the file to read. Optional, default is self.baseFileName + '.config'

 PROCEDURE:
   This is the list of JSON fields and tomo object variables
     RotationCenter  self.rotatinCenter
     RotationSlope   self.rotationCenterSlope
     UpperSlice      self.upperSlice
     LowerSlice      self.lowerSlice

(See tomo__define.pro)


TOMO::READ_SETUP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   TOMO::READ_SETUP

 PURPOSE:
   This function reads the setup information for a tomography data set from an ASCII .setup file.
   NOTE: These .setup files are present for pre-2020 data collected with raw data in netCDF format
   They contain original metadata including the dark current.
   In R1-0 the tomo class re-wrote these files with new metadata, including the rotation center.
   In R2-0 it reads these .setup files, and writes the new metadata to the .config file.

 CALLING SEQUENCE:
   result = TOMO->READ_SETUP(FILE)

 INPUTS:
   FILE:
     The name of the input .setup file.

 OUTPUTS:
   The data read from the file is read into the following fields in the tomo object
     *self.pDarks
     self.rotationCenter
     self.[x,y,z]PixelSize
     self.pConfig[SampleDescription1, UserName, Camera, SampleName, DarkFieldValue, Energy, ImagePixelSize]
 
 RETURN VALUE:
   The function returns 0 if it was unable to read the file, 1 if it was successful.

(See tomo__define.pro)


TOMO::READ_VOLUME

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   TOMO::READ_VOLUME

 PURPOSE:
   Reads in 3-D volume files written by TOMO::WRITE_VOLUME.
   These are either HDF5 or netCDF format.

 CALLING SEQUENCE:
   Result = READ_TOMO_VOLUME(FILE, STORE=STORE, XRANGE=XRANGE, YRANGE=YRANGE, ZRANGE=ZRANGE)

 INPUTS:
   FILE:
     The name of the volume file to be read.  If this is not specified then
     the function will use DIALOG_PICKFILE to allow the user to select a file.

 KEYWORD PARAMETERS:
   STORE
     If this keyword is set then the data is read into *self->pVolume, 
     self.nx, self,ny, and self.nz are set appropriately, and the function returns the scalar value 0.
     If this keyword is not set then the function returns the data read.
     
   The behavior of the following keywords depends on the file type:
   netCDF: Only the specified subset of the data is read from disk.
   HDF5:   The entire dataset is read from disk, but only the selected subset it returned.
           In the future this may be improved to only read the selected subset. 
   XRANGE=[xstart, xstop]
       The range of X values to read in. The default is to read the entire X range of the data
   YRANGE=[ystart, ystop]
       The range of Y values to read in. The default is to read the entire Y range of the data
   ZRANGE=[zstart, zstop]
       The range of Z values to read in. The default is to read the entire Z range of the data

 OUTPUTS:
   If the keyword STORE is not set then this function returns the data read.
   If the keyword is set then the function puts the data in *self.pVolume and returns 0.

 PROCEDURE:
   - Calls self->set_file_components to set self.inputFilename, self.directory, and self.baseFilename
   - For HDF files the following datasets are read if they are present
       /exchange/data              *self.pVolume or data returned by function
       /process/imageType          self.imageType
       /process/angles             *self.pAngles
       /process/[x,y,z]PixelSize   self.[x,y,z]PixelSize
   - For netCDF files the following variables and global attributes are read if present
       VOLUME                      *self.pVolume or data returned by function
       imageType                   self.imageType
       angles                      *self.pAngles
       scale_factor                self.preprocessScale
       [x,y,z]PixelSize            self.[x,y,z]PixelSize
       title                       self.pSampleConfig['SampleDescription1']
       operator                    self.pSampleConfig['UserName']
       camera                      self.pSampleConfig['Camera']
       sample                      self.pSampleConfig['SampleName']
       energy                      self.pSampleConfig['Energy']
       dark_current                self.pSampleConfig['DarkFieldValue'], *self.pDarks
       center                      self.rotationCenter
   - Calls TOMO::READ_SAMPLE_CONFIG to read additional metadata that is stored in that file

(See tomo__define.pro)


TOMO::RECONSTRUCT_SLICE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   TOMO::RECONSTRUCT_SLICE

 PURPOSE:
   Reconstructs a single slice in a tomography volume array.

 CALLING SEQUENCE:
   Result = RECONSTRUCT_SLICE(INPUT, CENTER=CENTER, SINOGRAM=SINOGRAM, COG=COG)

 INPUTS:
   INPUT:
     The slice to be reconstructed, dimensions [NX, N_PROJECTIONS]

 INPUT KEYWORD PARAMETERS:
   CENTER:
     The rotation center.  If this keyword is not specified then the
     center is assumed to be the center pixel of the slice.

 OUTPUT KEYWORD PARAMETERS:
   SINOGRAM:
     The computed sinogram. This can only be returned when the reconstruction method is
     Gridrec or Backproject, not tomoRecon.
   COG:
     The center of gravity of the sinogram, 1-D array. This can only be returned when the reconstruction method is
     Gridrec or Backproject, not tomoRecon.

 OUTPUTS:
   This function returns the reconstructed slice.  It is a floating point array of dimensions [NX, NX]

 PROCEDURE:
   Reconstructs the slice with the current reconstruction parameters set with TOMO::SET_RECON_PARAMS.

(See tomo__define.pro)


TOMO::RECONSTRUCT_VOLUME

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   TOMO::RECONSTRUCT_VOLUME

 PURPOSE:
   This procedure reconstructs a complete 3-D data set (X, Y, Theta) into a 3-D (X, Y, Z) volume.  

 CALLING SEQUENCE:
   TOMO->RECONSTRUCT_VOLUME

 PROCEDURE:
   - The input is normalized data in *self.pVolume.
   - The reconstruction is done using the parameters set in TOMO::SET_RECON_PARAMS
   - The rotation center for each slice is determined using self.rotationCenter and self.rotationCenterSlope
   - If the maximum angle is larger then 180 degrees then it is assumes the data is 360 degrees and calls
     TOMO::CONVERT_360_DATA to convert to 180.
   - If *self.pVolume is not of type FLOAT it is converted to FLOAT.
   - If self.reconMethod is tomoRecon then the reconstruction is done with TOMO::TOMO_RECON,
     otherwise it is done by reconstructing each slice with TOMO::RECONSTRUCT_SLICE.
   - The .config file is updated with TOMO::WRITE_SAMPLE_CONFIG.
     This updates the upper and lower slice numbers and rotation centers used for the reconstruction.
   - If self.reconDataType is not Float32 then the reconstructed data is converted to Int16 or UInt16.
   - If self.reconWriteOutput is not 0 then the output is written to disk by TOMO::WRITE_VOLUME,
     in the format selected by self.reconWriteFormat, i.e. 'HDF5' or 'netCDF'.
   - The output is returned in *self.pVolume, replacing the normalized data.

(See tomo__define.pro)


TOMO::REMOVE_ARTIFACTS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   TOMO::REMOVE_ARTIFACTS

 PURPOSE:
   Removes artifacts from tomography images and sinograms.

 CALLING SEQUENCE:
   Result = TOMO->REMOVE_ARTIFACTS(IMAGE)

 INPUTS:
   IMAGE:  
     The input array from which artifacts are to be removed.

 KEYWORD PARAMETERS:
   IMAGE2:
     A second input and output image when doing DOUBLE_CORRELATION
   ZINGERS:
     Set this keyword to remove zingers from the input image
   DOUBLE_CORRELATION:
     Set this keyword to remove zingers from the input using double
     correlation rather than a spatial detection
   RINGS:
     Set this keyword to remove ring artifacts from a sinogram
   DIFFRACTION:
     Set this keyword to removed diffraction artifacts from a sinogram
   WIDTH:
     Set this keyword to adjust the size of the filter kernal used in the
     artifact removal.  The default is 9 pixels.
   THRESHOLD:
     Set this keyword to adjust the threshold used in detecting zingers and
     diffraction artifacts.  The defaults are 1.2 for /ZINGER and
     /DOUBLE_CORRELATION and 0.8 for/DIFFRACTION
   DEBUG:
     Set this keyword to print debugging information

 OUTPUTS:
   This function returns an image with the specified artifacts removed.

 PROCEDURE:
   THIS STILL NEEDS TO BE DOCUMENTED.  For now, see the source code.

(See tomo__define.pro)


TOMO::RESTORE_SETTINGS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   TOMO::RESTORE_SETTINGS

 PURPOSE:
   This procedure restores the tomo settings from a file that was written by TOMO::SAVE_SETTINGS.
   The file can contain additional keys beyond those known to the tomo class, and these are ignored.
   This is the case when the file is written by the TOMO_DISPLAY class, since such files include
   TOMO_DISPLAY parameters as well.

 CALLING SEQUENCE:
   TOMO->RESTORE_SETTINGS, FILE

 INPUTS:
  FILE: Name of the file to read from to.

(See tomo__define.pro)


TOMO::SAVE_SETTINGS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   TOMO::SAVE_SETTINGS

 PURPOSE:
   This procedure saves the current tomo settings to a file.
   The file is in JSON format.

 CALLING SEQUENCE:
   TOMO->SAVE_SETTINGS, FILE

 INPUTS:
  FILE: Name of the file to write to.

(See tomo__define.pro)


TOMO::SET_PREPROCESS_PARAMS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   TOMO::SET_PREPROCESS_PARAMS

 PURPOSE:
   This procedure sets the preprocess parameters.
   It uses keywords to set the appropriate tomo member variable value.
   It is typically called before calling TOMO::PREPROCESS.

 CALLING SEQUENCE:
   TOMO->SET_PREPROCESS_PARAM, keyword=value, ...

 KEYWORD PARAMETERS
   Many of these value are explained in more depth in the IDL_Tomography documentation
   at https://cars-uchicago.github.io/IDL_Tomography/processing_options.html

   zingerWidth           Number of pixels used for zinger removal. 0=disable.
   zingerThreshold       Threshold for zinger removal when using median filter for projections.
   zingerDoubleThreshold Threshold for zinger removal when using double correlation for flat fields.
   dataType              Output data type: 'Float32' or 'UInt16'.
   writeOutput           1 to write the preprocessed output data to a file, 0 to not write.
   writeFormat           Output file format: 'HDF5' or 'netCDF'.
   scale                 Output scale factor.  Typically 10000.  Needed when output='UInt16'.
   threads               Number of threads to use for preprocessing.

(See tomo__define.pro)


TOMO::SET_RECON_PARAMS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   TOMO::SET_RECON_PARAMS

 PURPOSE:
   This procedure sets the reconstruction parameters.
   It uses keywords to set the appropriate TOMO member variable value.
   It is typically called before calling TOMO::RECONSTRUCT_SLICE or TOMO::RECONSTRUCT_VOLUME.

 CALLING SEQUENCE:
   TOMO->SET_RECON_PARAM, keyword=value, ...
   
 KEYWORD PARAMETERS
   Many of these value are explained in more depth in the IDL_Tomography documentation
   at https://cars-uchicago.github.io/IDL_Tomography/processing_options.html
   
   rotationCenter        Rotation center for slice 0.
   rotCenterSlope        Slope of the rotation in pixels/slice.
   reconMethod           Reconstruction method: 'tomoRecon', 'GridRec', or 'Backproject'.
   dataType              Output data type: 'Float32', 'Int16', or 'UInt16'.
   writeOutput           1 to write the reconstruction to a file, 0 to not write.
   writeFormat           Output file format: 'HDF5' or 'netCDF'.
   sinoScale             Scale factor that was used when preprocessing.
   reconScale            Scale factor for the output.  Typically 1e6 when dataType='Int16' or 'UInt16'.
   reconOffset           Offset value for the output.  Typically 32767 when dataType='UInt16'.
   paddedSinogramWidth   0=auto, 1=no padding, other values typically power of 2 and larger than NX.
   paddingAverage        Number of pixel to average on the image edges for padding.
   airPixels             Number of air pixels to average for secondary normalization.  0=disable.
   ringWidth             Number of pixels for ring artifact reduction.  0=disable.
   fluorescence          1 if this is fluorescence data, 0 if absorption (take logarithm of sinogram).
   threads               Number of threads to use for reconstruction with tomoRecon.
   slicesPerChunk        Number of slices per chunk for tomoRecon.  Not currently used.
   debug                 Debugging print level.  Larger numbers are more verbose output.
   dbgFile               File to write debugging output to.
   geom                  Gridrec/tomoRecon geom parameter
   pswfParam             Gridrec/tomoRecon pswf parameter
   sampl                 Gridrec/tomoRecon sampl parameter
   maxPixSize            Gridrec/tomoRecon maxPixSize parameter
   ROI                   Gridrec/tomoRecon ROI parameter
   X0                    Gridrec/tomoRecon X0 parameter
   Y0                    Gridrec/tomoRecon Y0 parameter
   ltbl                  Gridrec/tomoRecon ltbl parameter
   GR_filterName         Gridrec/tomoRecon filter name
   BP_method             Backproject method
   BP_filterName         Backproject filter name
   BP_filterSize         Backproject filter size
   RiemannInterpolation  Riemann interpolation method
   RadonInterpolation    Radon interpolation method

(See tomo__define.pro)


TOMO::SINOGRAM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   TOMO::SINOGRAM

 PURPOSE:
   To convert raw tomography data into a sinogram.

 CALLING SEQUENCE:
   result = TOMO->SINOGRAM(Input)

 INPUTS:
   Input
     An array of raw tomography data. INPUT(I, J) is the intensity at
     position I for view angle J. Each row is assumed to contain at least
     one air value at each end for normalization.
   COG=cog
     This keyword is used to return the measured and fitted
     center-of-gravity data for the sinogram. The center-of-gravity data are
     very useful for diagnosing problems such as backlash, beam hardening,
     detector saturation, etc. COG is dimensioned (n_angles, 2), where
     n_angles is the number of angles in the input array. COG(*,0) is the
     measured center-of-gravity data. COG(*,1) is the fitted data. The
     following command can then be given after the SINOGRAM command
     IDL> PLOT, COG(*,0)
     IDL> OPLOT, COG(*,1)
     to see is the sinogram data are reasonable.
 RETURN:
   The output array containing the corrected sinogram. It is always of type FLOAT.

 PROCEDURE:
   This routine creates a sinogram from raw tomography data. It does the
   following:
   -   Averages the air values for "airPixels" pixels on the left and
       right hand sides of the input.
   -   Logarithmation. output = -log(input/air). The air values are
       interpolated between the averaged values for the left and right
       hand edges of the image for each row.  This step is not performed
       if the /FLUORESCENCE keyword is set.
   -   The measured center-of-gravity is fitted to a sinusoidal curve
       of the form Y = A(0) + A(1)*SIN(X + A(2)).
           A(0) is the rotation axis
           A(1) is the amplitude
           A(2) is the phase
       The fitting is done using routine CURVE_FIT in the User Library.
       The shifting is done using routine POLY_2D which can shift by
       fractional pixels.

(See tomo__define.pro)


TOMO::TOMO_RECON

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   TOMO::TOMO_RECON

 PURPOSE:
   Performs tomographic reconstruction using the "gridrec" algorithm written
   by Bob Marr and Graham Campbell (not sure about authors) at BNL in 1997.

   It uses CALL_EXTERNAL to call tomoReconIDL.cpp, which is a thin wrapper for tomoRecon.cpp.
   The tomoRecon C++ code can be found at https://github.com/CARS-UChicago/tomoRecon.

 CALLING SEQUENCE:
   TOMO->GRIDREC, INPUT, OUTPUT, KEYWORD=VALUE, ...

 INPUTS:
   INPUT:
     The input normalized volume [NZ, NY, NPROJECTIONS].
     If this array is not of type Float it is first converted to Float.

 KEYWORD PARAMETERS:
   CREATE:
     Set this keyword to create the tomoRecon C++ object which must be done when changing any
     reconstruction parameters.  
     This should not be set when processing additional "chunks" in the same dataset.
     
   CENTER:
     The column containing the rotation axis. 
     - If this is not set then the center of the sinogram is used for all slices.
     - If this is a single value then it is used as the rotation center for all slices.
     - If this is an array then the number of elements must be the number of slices (NY) and
       slice N will be reconstructed using the rotation center in CENTER[N].

   ANGLES:
     An array containing the projection angles in degrees.  Default is *self.pAngles.

   WAIT:
     Set this keyword to wait for the reconstruction to complete before returning.
     When reconstructing in chunks this keyword can be omitted, which returns control
     to IDL while the reconstruction continues in the background.
     This allows overlapping I/O with reconstruction.

 OUTPUTS:
   OUTPUT:
       The reconstructed array [NX, NX, NY].  Type=Float.
 
 PROCEDURE:
   The tomoRecon code is multithreaded, with each thread processing 2 slices at a time.
   The processing includes
     - Optional secondary air normalization
     - Computing the sinogram (logarithm)
     - Optional ring artifact reduction on the sinogram
     - Reconstruction
   The reconstruction parameters are controlled by TOMO::SET_RECON_PARAMS.

(See tomo__define.pro)


TOMO::WRITE_SAMPLE_CONFIG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   TOMO::WRITE_SAMPLE_CONFIG

 PURPOSE:
   This writes some tomo object variables to fields in the JSON .config file which contains metadata.

 CALLING SEQUENCE:
   TOMO->WRITE_SAMPLE_CONFIG

 PROCEDURE:
   This is the list of JSON fields and TOMO object variables that are written to the .config file.
   Other fields in the file are not changed.
     RotationCenter  self.rotatinCenter
     RotationSlose   self.rotationCenterSlope
     UpperSlice      self.upperSlice
     LowerSlice      self.lowerSlice

(See tomo__define.pro)


TOMO::WRITE_VOLUME

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   TOMO::WRITE_VOLUME

 PURPOSE:
   Writes 3-D arrays containing either normalized or reconstructed data to a disk file.
   There are currently 2 file formats supported, HDF5 and netCDF.

 CALLING SEQUENCE:
   TOMO->WRITE_VOLUME, FILE, VOLUME

 INPUTS:
   FILE:
     The name of the file to be written.
   VOLUME:
     The 3-D volume data to be written.  The dimensions are NX, NY, NANGLES or NX, NY, NZ

 KEYWORD PARAMETERS:
   NETCDF:
     Set this keyword  to write files in netCDF file format.  
     If NETCDF is not set then files are written in HDF5 format.

   The following keywords are currently only supported for netCDF files.
   Support for HDF5 files may be added in the future.

   [X,Y,Z]OFFSET:
     The [X,Y,Z] offsets in the disk array to begin writing to.  Default is [0,0,0]

   [X,Y,Z]MAX:
     The maximum [X,Y,Z] size of the array on disk.
     Valid only when the file is first created, i.e. if APPEND is not specified.
     Default is the size of the Volume array in each dimension.

   APPEND:
     Open an existing file for appending or overwriting data.  Default is APPEND=0 which creates a new file.

 PROCEDURE:
   HDF5 files will contain the following datasets
     /exchange/data                The volume array
     /process/imageType            self.imageType
     /process/angles               *self.pAngles
     /process/[x,y,z]PixelSize     self.[x,y,z]PixelSize
     /process/rotationCenter       self.rotationCenter
     /process/rotationCenterSlope  self.rotationCenter
     /process/preprocessScale      self.rotationCenterSlope
     /process/dataOffset           self.preprocessOffset or self.reconOffset depending on self.imageType
     /process/dataScale            self.preprocessScale or self.reconScale depending on self.imageType
  
  netCDF files will contain the following:
    Dimensions:  NX, NY, NZ
    Variables:   VOLUME
    Global attributes:
      title
      camera
      operator
      sample
      imageType
      energy
      dark current
      center
      [x,y,z]PixelSize
      angles
      scale_factor 

(See tomo__define.pro)


WRITE_TOMO_VOLUME

[Previous Routine] [List of Routines]
 NAME:
   WRITE_TOMO_VOLUME

 PURPOSE:
   Writes 3-D volume files to be read later by READ_TOMO_VOLUME or TOMO::READ-VOLUME.

   This function is a simple wrapper around TOMO::WRITE_VOLUME.
   See the documentation for TOMO::WRITE_VOLUME 
   for more information.

 CALLING SEQUENCE:
   WRITE_TOMO_VOLUME, File, Volume

 PROCEDURE:
   This function simply creates a TOMO object and calls TOMO::WRITE_VOLUME.

(See write_tomo_volume.pro)