mspt.patient package¶
Submodules¶
mspt.patient.patient module¶
- class mspt.patient.patient.Patient(stopPwrDataRef, dcmData, configData)[source]¶
Bases: object
The class “Patient” aims to represent the patient. The patient is represented by a set of 3D matrices. It is built from the CT dicom image and the RS (Structure set) dicom file. The 3D matrices created are:
- CT Matrix: 3D matrix representing the CT image in Hounsfield Units.
- Density Matrix: 3D matrix representing the densities at each voxel of the CT Matrix. The conversion from CT number to density is made by the dicomReader.ctToDensityConv data.
- Relative Stopping Power matrix : 3D matrix representing the relative (to water) stopping power at each voxel of the CT Matrix. It is built using the data provided by physics.stoppingPower and the density matrix.
- Expected dose distribution (optional): It corresponds to the 3D matrix of the dose distribution (RD dicom file) computed beforehand when planning the treatment. If the RD dicom file is provided to the simulator the CT will be resized to cover the same volume as the RD dicom file. Moreover, the matrix containing the RD data is resampled to have the same spacing as the CT matrix.
- Volumes of Interest (VOIs) 3D masks: For each volume structure defined in the RS dicom file, a 3D matrix is created to store a binary mask (1 in the volume and 0 outside) of each structure.
- Three 3D arrays : X,Y,Z corresponding to the x,y,z coordinates in the dicom image of each voxel.
Parameters: - stopPwrDataRef – Stopping power data ( physics.stoppingPower.StoppingPower) to be used for the conversion from density to relative stopping power.
- dcmData – Dictionary containing the dicom readers. The keys are:’CT Image Storage’,’RT Structure Set Storage’,’RT Dose Storage’
- configData –
Dictionary configuring the motion. Mandatory keys are:
- ‘mainPath’ : corresponds to the path where any simulation will be saved.
- ‘nameSimulation’ : corresponds to the path where the current simulation will be saved.
- ‘typeFloat’ : The type of numpy float to be used: ‘float32’ or ‘float64’
- ‘staticDelivery’ : True if the patient is not moving, or False otherwise
- ‘ctPadding’ (if ‘staticDelivery’ is False) : True if the user wants to add margins of a specified density (see ‘paddedCTValue’ ) around the current CT image. This is useful, when the moving patient can be outside of the bounding box formed by the borders of the CT image.
- ‘padValueFRC’ (if ‘ctPadding’ is True) : Numpy array of 3 integer values : [ number of added frames : nbF, number of added rows : nbR, number of added columns : nbC]. For example : [ 0,0,10] will add 10 columns to the right of the CT image and 10 columns to the left of the CT image.
- ‘paddedCTValue’ (if ‘ctPadding’ is True): The value in CT number to use to pad the CT image. For example: air = -1000, water = 0.
- ‘storeMasksAsCPKL’ : True if the user wants to store the masks of the VOIs as numpy array in a cPickle structure (this allows to have access to the 3D numpy array outdise the simulation). False otherwise. Note: whether the value is set to True or False the masks are saved as png images.
- ‘skipSaveDensityImage’ : True to skip the storage of the 3D density matrix as png images. False otherwise. Moreover, if False and the patient is moving it will stored the 3D density array every time the array is updated.
- ‘listSaveDensImAlong’ (if ‘skipSaveDensityImage’ is False) : list of the axis along which the user wants to save the density images. Possible values are ‘x’ (i.e. the images are stored along the column axis of the dicom image), ‘y’ (i.e. the images are stored along the rows axis of the dicom image), ‘z’ (i.e. the images are stored along the frame axis of the dicom image). This can be used when the patient us moving and the user wants to see the motions from the side, the top or the front of the dicom image. Examlpes: listSaveDensImAlong = [] , or listSaveDensImAlong = [‘x’] or listSaveDensImAlong = [‘x’,’z’] ...
- ‘saveDensCPKL’ (if ‘skipSaveDensityImage’ is False) : True if the user wants to store the density 3D array in a cPickle structure (this allows to have access to the 3D numpy array outdise the simulation). False otherwise. Moreover, if False and the patient is moving it will stored the 3D density array every time the array is updated.
- ‘skipSaveStpPwrImage’ : True to skip the storage of the 3D relative stopping power matrix as png images. False otherwise, however, if the patient is moving it only stores it once.
- ‘listSaveStPwrImAlong’ (if ‘skipSaveStpPwrImage’ is False) : Similar to ‘listSaveDensImAlong’, to save the images of the 3D relative stopping power matrix.
- ‘saveStpPwrCPKL’ (if ‘skipSaveStpPwrImage’ is False): Similar to ‘saveDensCPKL’ to save the 3D array of the relative stopping power. However, if the patient is moving it only stores it once.
- ‘skipSaveDeff’ : Similar to ‘skipSaveStpPwrImage’ to save the 3D array of the radiologcial depth. If the patient is moving it stored the array at every update.
- ‘listSaveDeffAlong’ (if ‘skipSaveDeff’ is False) : Similar to ‘listSaveDensImAlong’, to save the images of the 3D radiological depth matrix.
- ‘saveDeffCPKL’ (if ‘skipSaveDeff’ is False) : Similar to ‘saveDensCPKL’ to save the 3D radiological depth matrix. If the patient is moving it stores the array at every update.
- ‘MeV’ : Constant to convert 1MeV to Joules: 1MeV = 1.602e-13J
- ‘protPerMU’ : Number of protons per MU to use.
- buildPatient(dcmCTReader, dcmRDReader, dcmRSReader, stopPwrDataRef)[source]¶
Function that “creates” the patient. It builds and initialize all the 3D arrays.
Parameters: - dcmCTReader – dicomCTReader giving access to the CT dicom series.
- dcmRDReader – dicomRDReader giving access to the RD dicom data. Note: dcmRDReader can be None is the user did not provide a RD dicom file since this dicom file is optional.
- dcmRSReader – dicomRSReader giving access to the RS dicom data.
- stopPwrDataRef – Stopping power data ( physics.stoppingPower.StoppingPower) to be used for the conversion from density to relative stopping power.
- calculateSSD0(sourceIECF, targetIECF, Xr, Yr, Zr, dens, startVec, incVec, sourceIECG, patientMask)[source]¶
The goal of this function is to find the indices of the voxels crossing the ray starting from source and aiming at target. To obtain the distance source-surface (SSD0), we look along the beam the first voxel with a radiological depth > 0.
Parameters: - sourceIECF – (x,y,z) coordinates of the beam’s source in cm in the in the IEC fixed coordinate system.
- targetIECF – (x,y,z) coordinates of the beam’s target in cm in the in the IEC fixed coordinate system.
- Xr – 3D array of x coordinates in the IEC gantry coordinate system
- Yr – 3D array of y coordinates in the IEC gantry coordinate system
- Zr – 3D array of z coordinates in the IEC gantry coordinate system
- dens – 3D density array. It is used to estimate where the patient body starts in case ‘patientMask’ is None (i.e. no ‘EXTERNAL’ structure was present in the RS dicom file)
- startVec – Coordinates (x,y,z) in cm of the voxel (0,nb Rows - 1, 0) in the IEC fixed coordinate system.
- incVec – Positive increment vector. It corresponds to (x_spacing, y_spacing, z_spacing) in cm.
- sourceIECG – (x,y,z) coordinates of the beam’s source in cm in the in the IEC gantry coordinate system.
- patientMask – 3D binary array : 1 inside the patient body , 0 outside. It can be None if no ‘EXTERNAL’ structure was present in the RS dicom file)
Returns: A tuple:
- The source to the patient body surface. If no voxel was found to be considered as the patient surface, the plan isocenter is used and the function returns the distance between the source and the isocenter.
- The list of voxels indices encountered in the CT volume along the central ray. The voxels are sorted in increasing distance from the source.
- The length of the ray inside each encountered voxel.
- computeEnergyReceivedByStructures(doseData, filename)[source]¶
Computes the energy in Joules received by each patient structure. The data is exported to a .txt file save in the simulation folder.
Parameters: - doseData – 3D numpy array representing the dose distribution.
- filename – Name of the file to save. Filename is preceded of ‘SummaryEnergy’ when the file is being written.
- computeLocalizedRadiologicalDepth(startVec, incVec, sourceVec, sourceIECG, rotMatrix, Xr, Yr, Zr, xrshift, yrshift, nbPositionsX=1, nbPositionsY=1, dispVec=(0, 0, 0), ener=None)[source]¶
Computes the radiological depth only for few rays. All the voxels encountered by the rays will have a value other than -1. The rest of the array will be equal to -1.
Parameters: - startVec – Coordinates (x,y,z) in cm of the voxel (0,nb Rows - 1, 0) in the IEC fixed coordinate system.
- incVec – Positive increment vector. It corresponds to (x_spacing, y_spacing, z_spacing) in cm.
- sourceVec – (x,y,z) coordinates of the beam’s source in cm in the in the IEC fixed coordinate system.
- sourceIECG – (x,y,z) coordinates of the beam’s source in cm in the in the IEC gantry coordinate system.
- rotMatrix – Rotation matrix corresponding to -(gantry angle). It allows to go from the IEC gantry coordinate system to the IEC Fixed coordinate system.
- Xr – 3D array of x coordinates in the IEC gantry coordinate system
- Yr – 3D array of y coordinates in the IEC gantry coordinate system
- Zr – 3D array of z coordinates in the IEC gantry coordinate system
- xrshift – beam shift along the x axis of the gantry coordinate system.
- yrshift – beam shift along the y axis of the gantry coordinate system. Note: (xrshift,yrshift) corresponds to the central ray.
- nbPositionsX – Number of positions (i.e. number of rays) along the X axis to the right and to the left of the central ray.
- nbPositionsY – Number of positions (i.e. number of rays) along the Y axis to the right and to the left of the central ray.
- dispVec – displacement vector in cm in the in the IEC fixed coordinate system.
- ener – Beam’s energy. Used if the user wants to store the radiological depth every time it is updated.
The rays simulated are all the possible combinations of nbPositionsX and nbPositionsY in addition to the central ray. For example, if nbPositionsX = nbPositionsY = 2. All the rays are [xrshift,yrshift], [xrshift + 1 * spacing,yrshift] , [xrshift + 1 * spacing, yrshift + 1 * spacing] , [xrshift + 1 * spacing, yrshift - 1 * spacing] , [xrshift , yrshift + 1 * spacing] , [xrshift - 1 * spacing, yrshift + 1 * spacing], [xrshift - 1 * spacing, yrshift - 1 * spacing], [xrshift - 1 * spacing,yrshift] , [xrshift , yrshift - 1 * spacing].....
Spacing = sqrt( incVec[0]^2 + incVec[1]^2)
Returns: A tuple: - The radiological depth array computed for the rays.
- The distance between the source and the patient surface along the central ray
- The list of voxels indices encountered in the CT volume along the central ray. The voxels are sorted in increasing distance from the source.
- computeRadiologicalDepth(startVec, incVec, sourceVec, dispVec=(0, 0, 0), ener=None)[source]¶
Computes the radiological depth of the entire patient volume for a given displacement vector.
Parameters: - startVec – Coordinates (x,y,z) in cm of the voxel (0,nb Rows - 1, 0) in the IEC fixed coordinate system.
- incVec – Positive increment vector. It corresponds to (x_spacing, y_spacing, z_spacing) in cm.
- sourceVec – (x,y,z) coordinates of the beam’s source in cm in the in the IEC fixed coordinate system.
- dispVec – displacement vector in cm in the in the IEC fixed coordinate system.
- ener – Beam’s energy. Used if the user wants to store the radiological depth every time it is updated.
Returns: 3D numpy array filled with the radiological depth values
- computeStoppingPowerArray(energy=0)[source]¶
Function that computes and fill the relative stopping power 3D array.
Parameters: energy – Energy of the beam being used.
- displaySliceOrderingInfo()[source]¶
Function that displays the slice information,i.e. slice number and slice location in mm
- exportSliceOrderingInfo()[source]¶
Export the slice ordering information (i.e. slice number-in first row- and slice location in mm -in second row)to a csv file in the folder /CSV_Data of the current working directory (i.e. ‘mainPath’/’nameSimulation’) .Note: Rows will become columns if there are more than 255 slices, in order to be able to open the CSV file in excel or numbers.
- fillIndicesVOIPatient()[source]¶
Function to find the indices of the voxels representing the patient body. It fills the patient attribute ‘_indPatient’. The Patient body corresponds to the voxels where the value is 1 in the mask of the VOI ‘EXTERNAL’.
- getDispIndices(dispVec)[source]¶
Calculates the displacement vector converted into indices
Parameters: dispVec – Displacement vector in the IEC Fixed coordinate system in cm, i.e., x_IEC_f = x_Dicom ,y_IEC_f = z_Dicom,z_IEC_f = -y_Dicom Returns: Indices in the dicom image (based on the dicom image coordinate system)
- getIsocenterInd()[source]¶
Function that computes and return the indices of the voxel representing the isocenter of the treatment plan.
Returns: Indices of the isocenter voxel : [frame, row, columns]
- getPatientArrayForAttr(attr)[source]¶
Get the 3D numpy array of the static patient for an attribute.
Parameters: attr – Attribute for a patient array. Attributes are:
- ‘x’: 3D numpy array storing the x values of each voxel in the dicom coordinate system.
- ‘y’: 3D numpy array storing the y values of each voxel in the dicom coordinate system.
- ‘z’: 3D numpy array storing the z values of each voxel in the dicom coordinate system.
- ‘density’ : 3D numpy array storing the density of each voxel.
- ‘stpPwrRatio’ : 3D numpy array storing the relative stopping power of each voxel.
- ‘prescribedDose’ : 3D numpy array storing the expected dose distribution obtained from the RD dicom file. If the used did not provide a RD dicom file, it returns None.
- ‘receivedDose’ : 3D numpy array storing the computed dose distribution.
- ‘pixelValues’ : 3D numpy array storing the CT number at each voxel.
- ‘MaskTumor’ : 3D binary array: 1 in the tumor, 0 outside.
- ‘maskVOIs’ : A list of tuple in which are stored the VOIs information as: ( mask 3D Numpy array , ROI name, ROI observation, ROI index, ROI type) - Type = ‘CLOSED_PLANAR’ or ‘POINT’
Returns: The patient array.
- getPatientDataForDisplVector(attr, dispVec=(0, 0, 0))[source]¶
Get the 3D numpy array of the moving patient for an attribute and a given displacement vector.
Parameters: - attr –
Attribute for a patient array. Attributes are:
- ‘x’: 3D numpy array storing the x values of each voxel in the dicom coordinate system. This array is the same if the patient is moving or not.
- ‘y’: 3D numpy array storing the y values of each voxel in the dicom coordinate system. This array is the same if the patient is moving or not.
- ‘z’: 3D numpy array storing the z values of each voxel in the dicom coordinate system. This array is the same if the patient is moving or not.
- ‘density’ : 3D numpy array storing the density of each voxel.
- ‘stpPwrRatio’ : 3D numpy array storing the relative stopping power of each voxel.
- ‘pixelValues’ : 3D numpy array storing the CT number at each voxel.
- ‘maskVOIs’ : A list of tuple in which are stored the VOIs information as: ( mask 3D Numpy array , ROI name, ROI observation, ROI index, ROI type) - Type = ‘CLOSED_PLANAR’ or ‘POINT’
- dispVec – Displacement vector in the IEC Fixed coordinate system in cm, i.e., x_IEC_f = x_Dicom ,y_IEC_f = z_Dicom,z_IEC_f = -y_Dicom
Returns: The patient array.
- attr –
- getPatientExtentInDynamicModel(dispVec)[source]¶
Computes new patient indices in dynamic model, i.e. after a displacement of dispVec.
Parameters: dispVec – Displacement vector in the IEC Fixed coordinate system in cm, i.e., x_IEC_f = x_Dicom ,y_IEC_f = z_Dicom,z_IEC_f = -y_Dicom Returns: the patient body indices in the 3D arrays, i.e., the voxels inside the moving patient body .
- getPatientExtentInStaticModel()[source]¶
Returns: the patient body indices in the 3D arrays, i.e., the voxels inside the patient body.
- getPatientMask()[source]¶
Get the patient body mask. It corresponds to the VOI ‘EXTERNAL’ in the RS dicom file.
Returns: 3D binary matrix: 1 in the patient body, 0 outside
- getSpacingInfo(key=None)[source]¶
Function to obtain the spacing information used in the patient arrays.
Parameters: key – If None (default), it returns the dictionary with the spacings in mm between the frames (‘frames’), rows (‘rows’) and columns (‘cols’). if key is not None, it should be ‘cols’ or ‘x_spacing’, ‘rows’ or ‘y_spacing’, ‘frames’ or ‘z_spacing’. Returns: the spacing information corresponding to key.
- getUnpaddedPatientDataForAttr(attr)[source]¶
Get the unpadded 3D numpy array of the patient for an attribute.
Parameters: attr – Attribute for a patient array. See getPatientArrayForAttr(attr) for more information on the attributes. Returns: The unpadded patient array.
- hotAndColdSpotsPerStrcuture(volRef, volTest, unpadded=False)[source]¶
Computes the hot and cold spots in the different structures. This function is called from scanning.deliverySimulation_Static_Dynamic for a moving patient. A spot is considered as a hot (cold) spot if its dose is higher (smaller) than 5% of the maximum of volRef.
Parameters: - volRef – 3D numpy array. Dose distribution of reference.
- volTest – 3D numpy array. Dose distribution to test.
- unpadded – True to use unpadded masks, False (default) otherwise.
Returns: Dictionary with the name of the VOIs as keys. The value of each of these key (i.e. for each VOI) is a dictionary whose keys are:
- ‘nbVoxels’: Number of voxels in the VOI
- ‘nbHotSpots’ : Number of hot spots in the VOI
- ‘nbColdSpots’ : Number of cold spots in the VOI
- ‘nbCorrectSpots’ : Number of spots with a ‘correct’ (i.e. within 5%) dose.
- ‘percHotSpots’ : Percentage of hot spots compared to the entire VOI.
- ‘percColdSpots’ : Percentage of cold spots compared to the entire VOI.
- ‘percCorrectSpots’ : Percentage of correct spots compared to the entire VOI.
- initPatientWithDicomData(stopPwrDataRef, dcmData)[source]¶
Create a patient from Dicom Data. Dicom Data should be provided by a dictionnary with 3 keys: ‘CT Image Storage’,’RT Structure Set Storage’,’RT Dose Storage’. Their values are respectively dicomCTReader, dicomRSReader, dicomRDReader.
Parameters: - stopPwrDataRef – Stopping power data ( physics.stoppingPower.StoppingPower) to be used for the conversion from density to relative stopping power.
- dcmData – Dictionary containing the dicom readers. The keys are:’CT Image Storage’,’RT Structure Set Storage’,’RT Dose Storage’
- saveDoseDistrAsRDDcmFile(newDose, filename)[source]¶
Store the “newDose” in a RD Dicom file.
Parameters: - newDose – 3D numpy array storing a dose distribution in Gy.
- filename – Name of the file to be saved. It will be saved in at ‘mainPath’/’nameSimulation’/ (see class initialization).
Note
If the user provides a RD dicom file to the simulator, the new RD files created will used the values of the tags used in the input RD file, otherwise it will rely on the tags and values used in the CT images and the RS dicom file and use a template of RD dicom file stored in the package of the simulator.
- setIsocenter(isoCoord)[source]¶
Function used from scanning.deliverySimulation_Static_Dynamic to set the treatment plan isocenter coordinates.
Parameters: isoCoord – treatment plan isocenter coordinates (x,y,z)
mspt.patient.tools module¶
- mspt.patient.tools.calcRadiolDepth(stPwrGrid, startVec, incVec, sourceVec, typeFloat)[source]¶
Calls the C extension: calcRadiolDepth_PythonExt and returns its result.
Parameters: - stPwrGrid – 3D grid of relative stopping power values
- startVec – Coordinates (x,y,z) in cm of the voxel (0,nb Rows - 1, 0) in the IEC fixed coordinate system.
- incVec – Positive increment vector. It corresponds to (x_spacing, y_spacing, z_spacing) in cm.
- sourceVec – (x,y,z) coordinates of the beam’s source in cm in the in the IEC fixed coordinate system.
- typeFloat – ‘float32’ or ‘float64’. It it the numpy float type to be used.
Note
All the arguments of the function (except typeFloat) must be numpy arrays of float values (typeFloat) and stored internally according to the ‘C’ order.
Returns: The radiological depth grid.
- mspt.patient.tools.calcRadiolDepthFewRays(stPwrGrid, startVec, incVec, sourceVec, targetVec, auxTargets, typeFloat)[source]¶
Calls the C extension: _fewRays_RadDepth_PythonExt and returns its result.
Parameters: - stPwrGrid – 3D grid of relative stopping power values
- startVec – Coordinates (x,y,z) in cm of the voxel (0,nb Rows - 1, 0) in the IEC fixed coordinate system.
- incVec – Positive increment vector. It corresponds to (x_spacing, y_spacing, z_spacing) in cm.
- sourceVec – (x,y,z) coordinates of the beam’s source in cm in the in the IEC fixed coordinate system.
- targetVec – (x,y,z) coordinates of the beam’s target in cm in the in the IEC fixed coordinate system.
- auxVec – array of (x,y,z) coordinates of the beam’s auxiliary targets (i.e., targets around the main target targetVec) in cm in the in the IEC fixed coordinate system.
- typeFloat – ‘float32’ or ‘float64’. It it the numpy float type to be used.
Note
All the arguments of the function (except typeFloat) must be numpy arrays of float values (typeFloat) and stored internally according to the ‘C’ order.
Returns: The radiological depth grid.
- mspt.patient.tools.fillPatientCT(ctGrid, newShape, indStart, typeFloat)[source]¶
Calls the C extension: fillCTArray_PythonExt and returns its result.
Parameters: - ctGrid – 3D numpy array of CT values
- newShape – shape of the new CT grid
- indStart – Indices where to start taking the CT values from the original CT grid in order to fill the new grid.
- typeFloat – ‘float32’ or ‘float64’. It it the numpy float type to be used.
Note
All the arguments of the function (except typeFloat) must be numpy arrays of float values (typeFloat) and stored internally according to the ‘C’ order.
Returns: The reshaped CT grid.
- mspt.patient.tools.fillPatientDensity(ctGrid, conversionTable, typeFloat)[source]¶
Calls the C extension: fillDensityArray_PythonExt and returns its result.
Parameters: - ctGrid – 3D numpy array of CT values
- conversionTable – Table used for the conversion lits of tuples : [ ( ,) ,( ,) , ( ,) ,( ,)], each tuple is composed of 2 elements, the CT value and the corresopnding mass density.
- typeFloat – ‘float32’ or ‘float64’. It it the numpy float type to be used.
Note
All the arguments of the function (except typeFloat) must be numpy arrays of float values (typeFloat) and stored internally according to the ‘C’ order.
Returns: The density grid filled with the density values from the original CT image.
- mspt.patient.tools.fillPatientDose(dimNewGrid, originalDoseGrid, imagePosition, imageEndPosition, imageOrientation, spacingInfoCT, spacingInfoRD, imagePositionRD, typeFloat)[source]¶
Calls the C extension: fillDoseArray_PythonExt and returns its result.
Parameters: - dimNewGrid – dimensions of the 3D array to fill with the dose contained in originalDoseGrid. Its size is m x n x q.
- originalDoseGrid – 3D array containing the planned dose extracted from RD dicom file. Its size can be different than m x n x q, it can be smaller or greater.
- imagePosition – coordinates (in mm) of the top left corner on the first slice of the volume representing the field of view. Equal to imagePositionRD if the field of view of dose grid is smaller than the field of view of the CT image.
- imageEndPosition – coordinates (in mm) of the bottom right corner on the last slice of the field of view
- imageOrientation – axis information in orginialDoseGrid: 1D array with 9 elements
- spacingInfoCT – spacing information (mm) in newDoseGrid: x:spacingInfoCT[0] ,y:spacingInfoCT[1] ,z:spacingInfoCT[2] ,
- spacingInfoRD – spacing information (mm) in originalDoseGrid (from RD File) : x:spacingInfoRD[0] ,y:spacingInfoRD[1] ,z:spacingInfoRD[2]
- imagePositionRD – coordinates (in mm) of the top left corner on the first slice of the original dose grid
- typeFloat – ‘float32’ or ‘float64’. It it the numpy float type to be used.
Note
All the arguments of the function (except typeFloat) must be numpy arrays of float values (typeFloat) and stored internally according to the ‘C’ order.
Returns: The dose grid filled with the values of the original dose grid and resampled to match the spacing of the CT image.
- mspt.patient.tools.fillPatientStopPwr(densGrid, conversionTable, correcFactorTable, typeFloat)[source]¶
Calls the C extension: fillStopPwrArray_PythonExt and returns its result.
Parameters: - densGrid – 3D grid of densiy values
- conversionTable – table used for the conversion from density to relative stopping power. Array of 3 rows and 4 columns. Row 0 : lowest bound of the density values for each medium, Row 1 : upper bound of the density values for each medium , Row 3: corresponding Stopping Power value. Each column correspond to 1 type of medium.
- correcFactorTable – Table 2 rows, n columns representing the correction factor used for the mass stopping power.
- typeFloat – ‘float32’ or ‘float64’. It it the numpy float type to be used.
Note
All the arguments of the function (except typeFloat) must be numpy arrays of float values (typeFloat) and stored internally according to the ‘C’ order.
Returns: The relative stopping power grid.
- mspt.patient.tools.singleRay(stPwrGrid, startVec, incVec, sourceVec, targetVec, typeFloat)[source]¶
Calls the C extension: _singleRay_PythonExt and returns its result.
Parameters: - stPwrGrid – 3D grid of relative stopping power values
- startVec – Coordinates (x,y,z) in cm of the voxel (0,nb Rows - 1, 0) in the IEC fixed coordinate system.
- incVec – Positive increment vector. It corresponds to (x_spacing, y_spacing, z_spacing) in cm.
- sourceVec – (x,y,z) coordinates of the beam’s source in cm in the in the IEC fixed coordinate system.
- targetVec – (x,y,z) coordinates of the beam’s target in cm in the in the IEC fixed coordinate system.
- typeFloat – ‘float32’ or ‘float64’. It it the numpy float type to be used.
Note
All the arguments of the function (except typeFloat) must be numpy arrays of float values (typeFloat) and stored internally according to the ‘C’ order.
Returns: The radiological depth grid.