Sinogram

Sinogram Toolbox

@author: king.r.paul@gmail.com

API

pymedphys.labs.paulking.sinogram.read_csv_file(file_name)[source]

read sinogram from csv file

Return patient ID and sinogram array produced by reading a RayStation sinogram CSV file with the provided file name.

Parameters:file_name (str) – long file name of csv file
Returns:
Return type:document_id, array

Notes

Files are produced by ExportTomoSinogram.py, Brandon Merz, RaySearch customer forum, 1/18/2018. File first row contains demographics. Subsequent rows correspond to couch positions. Leaf-open time range from zero to one.

Examples

“Patient name: ANONYMOUS^PATIENT, ID: 00000”,,,,,,,,, ,0,0,0,0,0,0,0,0,0,0,0,0,0.39123373,0.366435635 …

pymedphys.labs.paulking.sinogram.read_bin_file(file_name)[source]

read sinogram from binary file

Return sinogram np.array produced by reading an Accuray sinogram BIN file with the provided file name.

Parameters:file_name (str) – long file name of csv file
Returns:sinogram
Return type:np.array

Notes

BIN files are sinograms stored in binary format used in Tomotherapy calibration plans.

pymedphys.labs.paulking.sinogram.crop(sinogram)[source]

crop sinogram

Return a symmetrically cropped sinogram, such that always-closed leaves are excluded and the sinogram center is maintained.

Parameters:sinogram (np.array) –
Returns:sinogram
Return type:np.array
pymedphys.labs.paulking.sinogram.unshuffle(sinogram)[source]

unshuffle singram by angle

Return a list of 51 sinograms, by unshuffling the provided sinogram; so that all projections in the result correspond to the same gantry rotation angle, analogous to a fluence map.

Parameters:sinogram (np.array) –
Returns:unshuffled
Return type:list of sinograms
pymedphys.labs.paulking.sinogram.make_histogram(sinogram, num_bins=10)[source]

make a leaf-open-time histogram

Return a histogram of leaf-open-times for the provided sinogram comprised of the specified number of bins, in the form of a list of tuples: [(bin, count)…] where bin is a 2-element array setting the bounds and count in the number leaf-open-times in the bin.

Parameters:
  • sinogram (np.array) –
  • num_bins (int) –
Returns:

histogram – bin is a 2-element array

Return type:

list of tuples: [(bin, count)..]

pymedphys.labs.paulking.sinogram.find_modulation_factor(sinogram)[source]

read sinogram from csv file

Calculate the ratio of the maximum leaf open time (assumed fully open) to the mean leaf open time, as determined over all non-zero leaf open times, where zero is interpreted as blocked versus modulated.

Parameters:sinogram (np.array) –
Returns:modulation factor
Return type:float