OrsBoneAnalysis_39881c9e6f4311e88d25448a5b5d70c0¶
Tools to analyze bone datasets and segmentations.
The segmentation algorithms are taken from: - Buie et al., Bone, vol. 41, p.505-515, 2007. - Kohler et al., Bone, vol. 41, p.659-667, 2007.
| author: | ORS Team |
|---|---|
| contact: | http://theobjects.com |
| email: | info@theobjects.com |
| organization: | Object Research Systems (ORS), Inc. |
| address: | 760 St-Paul West, suite 101, Montréal, Québec, Canada, H3C 1M4 |
| copyright: | Object Research Systems (ORS), Inc. All rights reserved 2020. |
| date: | Jun 13 2018 15:51 |
| dragonflyVersion: | |
| 3.6.0.470 (D) | |
| UUID: | 39881c9e6f4311e88d25448a5b5d70c0 |
Class Code¶
-
class
OrsPythonPlugins.internalprojects.OrsBoneAnalysis_39881c9e6f4311e88d25448a5b5d70c0.OrsBoneAnalysis_39881c9e6f4311e88d25448a5b5d70c0.OrsBoneAnalysis_39881c9e6f4311e88d25448a5b5d70c0(varname=None, managed=True)¶ -
MAPPING_ALGORITHM_MIL= 'MIL'¶
-
MAPPING_ALGORITHM_SURFACENORMALS= 'Surface normals'¶
-
MAPPING_ALGORITHM_VOLUMEFRACTION= 'Volume fraction'¶
-
classmethod
OrsBoneAnalysis_39881c9e6f4311e88d25448a5b5d70c0_openGUI()¶ classmethod(function) -> method
Convert a function to be a class method.
A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:
- class C:
@classmethod def f(cls, arg1, arg2, …):
…
It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.
Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.
-
SEGMENTATION_ALGORITHM_BUIE= 'Buie'¶
-
SEGMENTATION_ALGORITHM_KOHLER= 'Kohler'¶
-
SEGMENTATION_ALGORITHM_KOHLER_LABEL_CORTICAL= 0¶
-
SEGMENTATION_ALGORITHM_KOHLER_LABEL_TRABECULAE= 1¶
-
UIDescriptors= [<ORSServiceClass.OrsPlugin.uidescriptor.UIDescriptor object>]¶
-
canComputeMeasurements()¶
-
cleanup()¶ Deletes the variables managed by the plugin. It is the place to remove callbacks and other references to Python objects that would prevent them to be garbage collected. This method is called during the process of deletion of the plugin. It calls for the cleanup and deletion of the forms.
-
closable= True¶
-
closeWidget(name)¶
-
interfacemethod
computeAnisotropyMappingFromMIL(aROI, areaOfAnalysisBox, areaOfAnalysisSpacing, useSingleVoxelInDirectionWithSmallerBoxLength, lengthToAnalyze, samplingDistance, countOrientations)¶ Computes a map of the anisotropy of a ROI using the mean intercept length (MIL)
Parameters: - aROI (ORSModel.ors.ROI) – bone segmentation
- areaOfAnalysisBox (ORSModel.ors.VisualBox) – visual box to use
- areaOfAnalysisSpacing (float) – distance between the points in the analysis area
- useSingleVoxelInDirectionWithSmallerBoxLength (bool) – if True, a single voxel will be used in the direction having the smaller length; otherwise, the same spacing will be used in that direction.
- lengthToAnalyze (float) – the distance to analyze per orientation per star
- samplingDistance (float) – the distance between each sample on the line of analysis
- countOrientations (int) – the count of lines to analyze per star
Returns: - channelAnisotropyMapping (ORSModel.ors.Channel) – map of anisotropy
- vectorFieldEigenvectorMax (ORSModel.ors.VectorField) – vector field of the eigenvector associated to the highest eigenvalue
-
interfacemethod
computeAnisotropyMappingFromSurfaceNormalsOnMesh(aMesh, areaOfAnalysisBox, areaOfAnalysisSpacing, useSingleVoxelInDirectionWithSmallerBoxLength, radiusOfInfluence, mappingsUseProjectionBasedAnisotropyComputation)¶ Computes a map of the anisotropy of a mesh using the surface normals
Parameters: - aMesh (ORSModel.ors.Mesh) – a bone contour
- areaOfAnalysisBox (ORSModel.ors.VisualBox) – visual box to use
- areaOfAnalysisSpacing (float) – distance between the points in the analysis area
- useSingleVoxelInDirectionWithSmallerBoxLength (bool) – if True, a single voxel will be used in the direction having the smaller length; otherwise, the same spacing will be used in that direction.
- radiusOfInfluence (float) – distance from the analysis point to the last considered anisotropy element
- mappingsUseProjectionBasedAnisotropyComputation (bool) – anisotropy computation method. If True, the projection based method is used; if False, the eigenvalues from the tensor of inertia are taken.
Returns: - channelAnisotropyMapping (ORSModel.ors.Channel) – map of anisotropy
- vectorFieldEigenvectorMax (ORSModel.ors.VectorField) – vector field of the eigenvector associated to the highest eigenvalue
- channelToFillNormOfGradient (ORSModel.ors.Channel) – map of the norm of the gradient
- channelToFillDivergence (ORSModel.ors.Channel) – map of the divergence
- vectorFieldCurl (ORSModel.ors.VectorField) – curl of the orientation field
- channelToFillNormOfCurl (ORSModel.ors.Channel) – norm of the curl of the orientation field
-
interfacemethod
computeAnisotropyMappingFromSurfaceNormalsOnROI(aROI, areaOfAnalysisBox, areaOfAnalysisSpacing, useSingleVoxelInDirectionWithSmallerBoxLength, radiusOfInfluence, mappingsUseProjectionBasedAnisotropyComputation, meshSmoothingRepetitions)¶ Computes a map of the anisotropy of a ROI using the surface normals
Parameters: - aROI (ORSModel.ors.ROI) – bone segmentation
- areaOfAnalysisBox (ORSModel.ors.VisualBox) – visual box to use
- areaOfAnalysisSpacing (float) – distance between the points in the analysis area
- useSingleVoxelInDirectionWithSmallerBoxLength (bool) – if True, a single voxel will be used in the direction having the smaller length; otherwise, the same spacing will be used in that direction.
- radiusOfInfluence (float) – distance from the analysis point to the last considered anisotropy element
- mappingsUseProjectionBasedAnisotropyComputation (bool) – anisotropy computation method. If True, the projection based method is used; if False, the eigenvalues from the tensor of inertia are taken.
- meshSmoothingRepetitions (int) – number of times the mesh obtained from the ROI should be smoothed before computing the anisotropy
Returns: - channelAnisotropyMapping (ORSModel.ors.Channel) – map of anisotropy
- vectorFieldEigenvectorMax (ORSModel.ors.VectorField) – orientation field of the eigenvector associated to the highest eigenvalue
- channelToFillNormOfGradient (ORSModel.ors.Channel) – map of the norm of the gradient
- channelToFillDivergence (ORSModel.ors.Channel) – map of the divergence
- vectorFieldCurl (ORSModel.ors.VectorField) – curl of the orientation field
- channelToFillNormOfCurl (ORSModel.ors.Channel) – norm of the curl of the orientation field
-
computeMappingsAnisotropy()¶
-
computeMeasurements()¶
-
interfacemethod
computeVolumeFractionMapping(aROI, areaOfAnalysisBox, areaOfAnalysisSpacing, useSingleVoxelInDirectionWithSmallerBoxLength, radius)¶ Computes a map of the volume fraction of a ROI
Parameters: - aROI (ORSModel.ors.ROI) – bone segmentation
- areaOfAnalysisBox (ORSModel.ors.VisualBox) – visual box to use
- areaOfAnalysisSpacing (float) – distance between the points in the analysis area
- useSingleVoxelInDirectionWithSmallerBoxLength (bool) – if True, a single voxel will be used in the direction having the smaller length; otherwise, the same spacing will be used in that direction.
- radius (float) – the distance from the analysis point to the last considered ROI element
Returns: channelVolumeFractionMapping (ORSModel.ors.Channel) – map of volume fraction
-
deleteWorkingObjectsKohlerMethod()¶
-
interfacemethod
exportCorticalTrabecularMeasurementsToCSV(measurementsList, filename)¶ Exports a list of measurements to a CSV file
Parameters: - measurementsList (transient AbstractCorticalTrabecularMeasurement) [count=[0, None]] – list of measurements (instances of AbstractCorticalTrabecularMeasurement)
- filename (file saving) – fully qualified .csv file name
-
exportCurrentCorticalTrabecularMeasurementsToCSV(filename)¶
-
interfacemethod
fillBone(boneROI, thresholdDistanceCloseHoles, aProgress)¶ Fills the bone in preparation for the segmentation as cortical and trabecular bone.
Parameters: - boneROI (ORSModel.ors.ROI) – bone segmentation (where the bone mineralization is present)
- thresholdDistanceCloseHoles (float) – threshold distance to close the holes of the full bone
- aProgress (ORSModel.ors.Progress) – progress object
Returns: filledBoneROI (ORSModel.ors.ROI) – filled bone
-
fillBoneImplementation()¶
-
getCorticalTrabecularBoneROI()¶
-
getCorticalTrabecularMeasurementsCorticalBoneROI()¶
-
getCorticalTrabecularMeasurementsFilledBoneROI()¶
-
getCorticalTrabecularMeasurementsTrabecularBoneROI()¶
-
getMappingsAlgorithm()¶
-
getMappingsMILOrientations()¶
-
getMappingsMILRadius()¶
-
getMappingsMILSampling()¶
-
getMappingsMeshSmoothingRepetitions()¶
-
getMappingsROI()¶
-
getMappingsRadiusOfInfluence()¶
-
getMappingsSpacing()¶
-
getMappingsUseProjectionBasedAnisotropyComputation()¶
-
getMappingsUseSingleVoxelInDirectionWithSmallerBoxLength()¶
-
getMappingsVisualBox()¶
-
getMappingsVolumeFractionRadius()¶
-
getMultiROIDisconnectedIsosurfaces()¶
-
getSegmentCorticalTrabecularBoneKohlerWorkingObjects()¶
-
getSegmentationCorticalTrabecularBoneAlgorithm()¶
-
getSegmentationCorticalTrabecularThresholdDistanceCloseHoles()¶
-
getSegmentationCorticalTrabecularTrabecularThickness()¶
-
getTableCorticalTrabecularMeasurements()¶
-
classmethod
importAllLoggingClasses()¶ This method is called to make any class extension available for macro playing. It should:
- import all class extension;
- return a list of classes where logging is supported.
Returns: output (list of classes) – list of classes where logging is supported by the current plugin
-
keepAlive= False¶
-
multiple= False¶
-
classmethod
openGUI()¶
-
openWidget(name, dock=None, tab=None, x=-1, y=-1, w=-1, l=-1, order=-1)¶
-
refreshAfterPreferencesChanged()¶
-
refreshDataTableCorticalTrabecularMeasurements()¶
-
savable= False¶
-
segmentCorticalTrabecularBone()¶
-
interfacemethod
segmentCorticalTrabecularBoneBuie(boneROI, filledBoneROI, trabecularThickness, aProgress)¶ Segments a bone as cortical and trabecular bone.
Parameters: - boneROI (ORSModel.ors.ROI) – bone segmentation (where the bone mineralization is present)
- filledBoneROI (ORSModel.ors.ROI) – filled bone
- trabecularThickness (float) – threshold distance to close the holes of the trabecular area
- aProgress (ORSModel.ors.Progress) – progress object
Returns: - corticalBone (ORSModel.ors.ROI) – cortical bone. It is the intersection of the cortical area with the provided bone segmentation.
- trabecularBone (ORSModel.ors.ROI) – trabecular bone. It is the intersection of the trabecular area with the provided bone segmentation.
Note
Based on the algorithm of Buie et al., Bone, vol. 41, p.505-515, 2007.
-
interfacemethod
segmentCorticalTrabecularBoneKohlerStep1(boneROI, filledBoneROI, aProgress)¶ Segments a bone as cortical and trabecular bone.
This is the first of 2 steps, where a multiROI of isosurfaces is produced. The segmentation in cortical and trabecular bone will be done in the second step, where a threshold of volume per isosurface should be provided.
Parameters: - boneROI (ORSModel.ors.ROI) – bone segmentation (where the bone mineralization is present)
- filledBoneROI (ORSModel.ors.ROI) – filled bone
- aProgress (ORSModel.ors.Progress) – progress object
Returns: aSegmentCorticalTrabecularBoneKohlerWorkingObjects (transient SegmentCorticalTrabecularBoneKohlerWorkingObjects) – object keeping the information about temporary instances required to perform the second step of the Kohler method.
Note
Based on the algorithm of Kohler et al., Bone, vol. 41, p.659-667, 2007.
-
interfacemethod
segmentCorticalTrabecularBoneKohlerStep2(aSegmentCorticalTrabecularBoneKohlerWorkingObjects, thresholdMaxVolumeTrabecularIsosurface, aProgress)¶ Segments a bone as cortical and trabecular bone.
This is the second of 2 steps, where the segmentation in cortical and trabecular bone is obtained from the multiROI of isosurfaces produced at the first step and a threshold of volume per isosurface should be provided.
The working objects are deleted at the end of this method.
Parameters: - aSegmentCorticalTrabecularBoneKohlerWorkingObjects (transient SegmentCorticalTrabecularBoneKohlerWorkingObjects) – object keeping the information about temporary instances required to perform the second step of the Kohler method. It is an instance of SegmentCorticalTrabecularBoneKohlerWorkingObjects, but should not be constructed manually, but rather be obtained from the first step.
- thresholdMaxVolumeTrabecularIsosurface (float) – maximal volume (in m^3) of the isosurface to be considered as trabeculae
- aProgress (ORSModel.ors.Progress) – progress object
Returns: - corticalBone (ORSModel.ors.ROI) – cortical bone. It is the intersection of the cortical area with the provided bone segmentation.
- trabecularBone (ORSModel.ors.ROI) – trabecular bone. It is the intersection of the trabecular area with the provided bone segmentation.
Note
Based on the algorithm of Kohler et al., Bone, vol. 41, p.659-667, 2007.
-
interfacemethod
segmentCorticalTrabecularBoneKohlerStep2Cancelling(aSegmentCorticalTrabecularBoneKohlerWorkingObjects)¶ Deletes the working objects used in the Kohler method of segmentation of the cortical and trabecular bone of a bone segmentation.
Parameters: aSegmentCorticalTrabecularBoneKohlerWorkingObjects (transient SegmentCorticalTrabecularBoneKohlerWorkingObjects) – object keeping the information about temporary instances required to perform the second step of the Kohler method. It is an instance of SegmentCorticalTrabecularBoneKohlerWorkingObjects, but should not be constructed manually, but rather be obtained from the first step. Note
Based on the algorithm of Kohler et al., Bone, vol. 41, p.659-667, 2007.
-
segmentCorticalTrabecularBoneKohlerStep2CancellingImplementation()¶
-
segmentCorticalTrabecularBoneKohlerStep2Implementation(volumeThreshold)¶
-
setCorticalTrabecularBoneROI(boneROI)¶
-
setCorticalTrabecularMeasurementsCorticalBoneROI(corticalTrabecularMeasurementsCorticalBoneROI)¶
-
setCorticalTrabecularMeasurementsFilledBoneROI(filledBoneROI)¶
-
setCorticalTrabecularMeasurementsTrabecularBoneROI(corticalTrabecularMeasurementsTrabecularBoneROI)¶
-
setMappingsAlgorithm(mappingsAlgorithm)¶
-
setMappingsMILOrientations(mappingsMILOrientations)¶
-
setMappingsMILRadius(mappingsMILRadius)¶
-
setMappingsMILSampling(mappingsMILSampling)¶
-
setMappingsMeshSmoothingRepetitions(mappingsMeshSmoothingRepetitions)¶
-
setMappingsROI(mappingsROI)¶
-
setMappingsRadiusOfInfluence(mappingsRadiusOfInfluence)¶
-
setMappingsSpacing(mappingsSpacing)¶
-
setMappingsUseProjectionBasedAnisotropyComputation(mappingsUseProjectionBasedAnisotropyComputation)¶
-
setMappingsUseSingleVoxelInDirectionWithSmallerBoxLength(mappingsUseSingleVoxelInDirectionWithSmallerBoxLength)¶
-
setMappingsVisualBox(mappingsVisualBox)¶
-
setMappingsVolumeFractionRadius(mappingsVolumeFractionRadius)¶
-
setSegmentationCorticalTrabecularBoneAlgorithm(segmentationCorticalTrabecularBoneAlgorithm)¶
-
setSegmentationCorticalTrabecularThresholdDistanceCloseHoles(segmentationCorticalTrabecularThresholdDistanceCloseHoles)¶
-
setSegmentationCorticalTrabecularTrabecularThickness(segmentationCorticalTrabecularTrabecularThickness)¶
-
showInToolbar= True¶
-
classmethod
toolsMenu()¶ classmethod(function) -> method
Convert a function to be a class method.
A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:
- class C:
@classmethod def f(cls, arg1, arg2, …):
…
It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.
Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.
-
classmethod
updateColorsMultiROIDisconnectedIsosurfaces(aMultiROIDisconnectedIsosurfaces, npLabelsVolumeInMeterCube, thresholdMaxVolumeTrabecularIsosurface=0, alphaValue=0.5)¶
-
updateColorsMultiROIDisconnectedIsosurfacesImplementation(thresholdMaxVolumeTrabecularIsosurface)¶
-
updateROIValidity(roiDirtyGUID)¶
-