Dijkstra¶
Inheritance diagram¶
Classes¶
Dijkstra¶
-
class
ORSModel.ors.Dijkstra¶ Bases:
ORSModel.ors.Unmanaged-
cleanDistanceMapChannel(self, outputChannel: ORSModel.ors.Channel) → None¶ Removes boundaries or non reached value from a distance map channel.
Parameters: outputChannel (ORSModel.ors.Channel) – a distance map channel (an Channel)
-
createDistanceMap(self, lOutputChannelDistanceMap: ORSModel.ors.Channel, lOutputChannelTraceBack: ORSModel.ors.Channel, lOutputChannelLabel: ORSModel.ors.Channel) → None¶ Creates a distance map starting from all the providedROI sources.
Parameters: - lOutputChannelDistanceMap (ORSModel.ors.Channel) – the distance map generated by the Dijkstra algorithm (an Channel)
- lOutputChannelTraceBack (ORSModel.ors.Channel) – a traceback channel, can be NULL (an Channel)
- lOutputChannelLabel (ORSModel.ors.Channel) – a label channel, can be NULL (an Channel)
-
createDistanceMapForMaxDistance(self, lOutputChannelDistanceMap: ORSModel.ors.Channel, maxDistance: float, lOutputChannelTraceBack: ORSModel.ors.Channel, lOutputChannelLabel: ORSModel.ors.Channel, continueDijkstra: bool) → None¶ Creates a distance map until a providedDijkstra distance is reached, starting from all the provided ROI sources.
Parameters: - lOutputChannelDistanceMap (ORSModel.ors.Channel) – the distance map generated by the Dijkstra algorithm (an Channel)
- maxDistance (float) – the Dijkstra distance to reach before stopping to process new voxels (a double)
- lOutputChannelTraceBack (ORSModel.ors.Channel) – a traceback channel, can be NULL (an Channel)
- lOutputChannelLabel (ORSModel.ors.Channel) – a label channel, can be NULL (an Channel)
- continueDijkstra (bool) – TRUE if it is not the first time this call is done on this instance of Dijkstra with the same distance map and that the algorithm must continue, FALSE to start over
-
createDistanceMapForNBIteration(self, lOutputChannelDistanceMap: ORSModel.ors.Channel, forNbIteration: int, lOutputChannelTraceBack: ORSModel.ors.Channel, lOutputChannelLabel: ORSModel.ors.Channel, autoUpdateROI: bool, continueDijkstra: bool) → None¶ Creates a distance map for a given number of voxels, starting from all the providedROI sources.
Parameters: - lOutputChannelDistanceMap (ORSModel.ors.Channel) – the distance map generated by the Dijkstra algorithm (an Channel)
- forNbIteration (int) – the number of voxels to be processed by the Dijkstra algorithm (an unsigned int)
- lOutputChannelTraceBack (ORSModel.ors.Channel) – a traceback channel, can be NULL (an Channel)
- lOutputChannelLabel (ORSModel.ors.Channel) – a label channel, can be NULL (an Channel)
- autoUpdateROI (bool) – TRUE if the source ROIs should be updated with their diffusion result, FALSE otherwise
- continueDijkstra (bool) – TRUE if it is not the first time this call is done on this instance of Dijkstra with the same distance map and that the algorithm must continue, FALSE to start over
-
createDistanceMapUntilAnyPointInTargetRoiIsReached(self, lOutputChannelDistanceMap: ORSModel.ors.Channel, aTargetVolumeROI: ORSModel.ors.ROI, lOutputChannelTraceBack: ORSModel.ors.Channel, continueDijkstra: bool) → None¶ Creates a distance map until any stop point provided in aROI are reached, starting from all the provided ROI sources.
Parameters: - lOutputChannelDistanceMap (ORSModel.ors.Channel) – the distance map generated by the Dijkstra algorithm (an Channel)
- aTargetVolumeROI (ORSModel.ors.ROI) – TODO DOCUMENT_ME
- lOutputChannelTraceBack (ORSModel.ors.Channel) – a traceback channel, can be None (a Channel)
- continueDijkstra (bool) – a label channel, can be None (a Channel)
-
createDistanceMapUntilPointInWorldCoordinatesIsReached(self, lOutputChannelDistanceMap: ORSModel.ors.Channel, xStopPointInWorld: float, yStopPointInWorld: float, zStopPointInWorld: float, lOutputChannelTraceBack: ORSModel.ors.Channel, lOutputChannelLabel: ORSModel.ors.Channel, continueDijkstra: bool) → None¶ Parameters: - lOutputChannelDistanceMap (ORSModel.ors.Channel) – Z position of a world coordinate
- xStopPointInWorld (float) – the number of voxels to be processed after the stop condition is matched (an uint32_t)
- yStopPointInWorld (float) – a traceback channel, can be NULL (an Channel)
- zStopPointInWorld (float) – a label channel, can be NULL (an Channel)
- lOutputChannelTraceBack (ORSModel.ors.Channel) – TRUE if it is not the first time this call is done on this instance of Dijkstra with the same distance map and that the algorithm must continue, FALSE to start over
- lOutputChannelLabel (ORSModel.ors.Channel) –
- continueDijkstra (bool) –
-
createDistanceMapUntilPointsAreReached(self, lOutputChannelDistanceMap: ORSModel.ors.Channel, positionTripleInSourceRef: int, nbPosition: int, waitForNIndex: int, lOutputChannelTraceBack: ORSModel.ors.Channel, lOutputChannelLabel: ORSModel.ors.Channel, breakForAny: bool, continueDijkstra: bool) → None¶ Creates a distance map until any or all stop points provided are reached, starting from all the providedROI sources.
Parameters: - lOutputChannelDistanceMap (ORSModel.ors.Channel) – the distance map generated by the Dijkstra algorithm (an Channel)
- positionTripleInSourceRef (int) – a collection of x,y,z triplets stop points in input channel referential (an uint32_t*)
- nbPosition (int) – the number of triplets present in the collection of triplets stop points (an uint32_t)
- waitForNIndex (int) – the number of voxels to be processed after the stop condition is matched (an uint32_t)
- lOutputChannelTraceBack (ORSModel.ors.Channel) – a traceback channel, can be NULL (an Channel)
- lOutputChannelLabel (ORSModel.ors.Channel) – a label channel, can be NULL (an Channel)
- breakForAny (bool) – TRUE if the algorithm has to stop for any points, FALSE if all the points have to be reached to stop
- continueDijkstra (bool) – TRUE if it is not the first time this call is done on this instance of Dijkstra with the same distance map and that the algorithm must continue, FALSE to start over
-
getAlphaParameter(self) → float¶ Gets the alpha parameter for the metric == 1.
Note
Only useful when metric is set to 1.
Returns: output (float) – the alpha parameter (a double)
-
getClassNameStatic() → str¶ getClassNameStatic
Returns: output (str) –
-
getEuclideanBias(self) → float¶ Gets the Euclidean bias that will be the minimumDijkstra distance between voxels.
Note
Neighbors of distance 1 will have a bias of spacialTerm
Note
Neighbors of distance sqrt(2) will have a bias of sqrt(2)*spacialTerm
Note
Neighbors of distance sqrt(3) will have a bias of sqrt(3)*spacialTerm
Returns: output (float) – the minimum distance between voxels (a double)
-
getGaussianPeakCenterValue(self) → float¶ Sets the peak position of the gaussian used if the metric == 1.
Note
Only useful when metric is set to 1.
Returns: output (float) – peak center of the gaussian (a double)
-
getIndexOfStopPointReach(self) → int¶ Retrieve the index reached by theDijkstra algorithm.
Note
Only useful when distance map was generated using methods createDistanceMapUntilAnyPointInTargetRoiIsReached, createDistanceMapUntilPointInWorldCoordinatesIsReached or createDistanceMapUntilPointsAreReached.
Returns: output (int) – index in the input channel (a int64_t)
-
getKappa(self) → float¶ Gets the kappa parameter for the metric == 1.
Note
Only useful when metric is set to 1.
Returns: output (float) – the kappa parameter (a double)
-
getMetric(self) → int¶ Gets the metric used by theDijkstra algorithm.
Note
If the metric chosen is 0, the metric function will be: DijkstraDistanceBetween(a,b) = (Ia-Ib)^2 + EuclideanBias*EuclideanDistance(a,b);
Note
If the metric chosen is 1, the metric function will be: DijkstraDistanceBetween(a,b) = (Ia-Ib)^2 + EuclideanBias*EuclideanDistance(a,b) + alpha(1.0 - exp(-(b-gaussianPeakCenterValue)^2/kappa*sigmaPow2)); where a and b are Neighbor, Ia and Ib are intensity at a and b
Returns: output (int) – 0 or 1
-
getNeighborCount(self) → int¶ Gets the number of neighbors used by theDijkstra algorithm (the connectivity).
Note
Can be 6, 18 or 26
Returns: output (int) – the number of neighbors (an char)
-
getROI(self, index: int) → ROI¶ Retrieves a particularROI from the index specified slot.
Note
A maximum of 10 ROIs can be provided. The ROIs provided must be of the same shape as the input channel.
Parameters: index (int) – the slot index (an unsigned char) Returns: output (ORSModel.ors.ROI) – the ROI associated with this slot index (an ROI), or NULL if no ROI is at that slot
-
getROICount(self) → int¶ Returns the number of ROIs that have been set as sources.
Note
A maximum of 10 ROI can be provided.
Returns: output (int) – the number of ROIs that have been provided (an char)
-
getSigmaPow2(self) → float¶ Gets the variance used by the gaussian used if the metric == 1.
Note
Only useful when metric is set to 1.
Returns: output (float) – variance of the gaussian (a double)
-
resetROIs(self) → None¶ Empties all the sourceROI slots.
-
setAlphaParameter(self, alpha: float) → None¶ Sets the alpha parameter for the metric == 1.
Note
Only useful when metric is set to 1.
Parameters: alpha (float) – the alpha parameter (a double)
-
setEuclideanBias(self, EuclideanBias: float) → None¶ Provides an Euclidean bias that will be the minimumDijkstra distance between voxels.
Note
Neighbors of distance 1 will have a bias of spacialTerm.
Note
Neighbors of distance sqrt(2) will have a bias of sqrt(2)*spacialTerm.
Note
Neighbors of distance sqrt(3) will have a bias of sqrt(3)*spacialTerm.
Parameters: EuclideanBias (float) – the minimum distance between voxels (a double)
-
setGaussianPeakCenterValue(self, aPeakCenter: float) → None¶ Sets the peak position of the gaussian used if the metric == 1.
Note
Only useful when metric is set to 1.
Parameters: aPeakCenter (float) – peak center of the gaussian (a double)
-
setInputChannelAndWorkingArea(self, inputChannel: ORSModel.ors.Channel, minX: int, minY: int, minZ: int, maxX: int, maxY: int, maxZ: int, currentT: int) → None¶ Sets the channel that will be used by theDijkstra algorithm to calculate distance.
Note
The min and max boundaries must not describe a space bigger than the input channel.
Parameters: - inputChannel (ORSModel.ors.Channel) – the input channel (an Channel)
- minX (int) – the minimum X index in the input channel (an unsigned short)
- minY (int) – the minimum Y index in the input channel (an unsigned short)
- minZ (int) – the minimum Z index in the input channel (an unsigned short)
- maxX (int) – the maximum X index in the input channel (an unsigned short)
- maxY (int) – the maximum Y index in the input channel (an unsigned short)
- maxZ (int) – the maximum Z index in the input channel (an unsigned short)
- currentT (int) –
-
setInputLabelsChannel(self, aInputLabelsChannel: ORSModel.ors.Channel) → None¶ Parameters: aInputLabelsChannel (ORSModel.ors.Channel) –
-
setInputMultiROI(self, aInputMultiROI: ORSModel.ors.MultiROI) → None¶ Parameters: aInputMultiROI (ORSModel.ors.MultiROI) –
-
setKappa(self, kappa: float) → None¶ Sets the kappa parameter for the metric == 1.
Note
Only useful when metric is set to 1.
Parameters: kappa (float) – the kappa parameter (a double)
-
setMaskROI(self, IMaskROI: ORSModel.ors.ROI) → None¶ Parameters: IMaskROI (ORSModel.ors.ROI) –
-
setMetric(self, metricType: int) → None¶ Selects the metric to be used by theDijkstra algorithm.
Note
If the metric chosen is 0, the metric function will be: DijkstraDistanceBetween(a,b) = (Ia-Ib)^2 + EuclideanBias*EuclideanDistance(a,b);
Note
If the metric chosen is 1, the metric function will be: DijkstraDistanceBetween(a,b) = (Ia-Ib)^2 + EuclideanBias*EuclideanDistance(a,b) + alpha(1.0 - exp(-(b-gaussianPeakCenterValue)^2/kappa*sigmaPow2)); where a and b are Neighbors, Ia and Ib are intensity at a and b
Parameters: metricType (int) – 0 or 1
-
setNeighborCountTo18(self) → None¶ Sets the number of neighbors used by theDijkstra algorithm to 6 ( Neighbor distance == 1).
-
setNeighborCountTo26(self) → None¶ Sets the number of neighbors used by theDijkstra algorithm to 6 ( Neighbor distance == 1).
-
setNeighborCountTo6(self) → None¶ Sets the number of neighbors used by theDijkstra algorithm to 6 ( Neighbor distance == 1).
-
setProgressObject(self, IProgress: ORSModel.ors.Progress) → None¶ Parameters: IProgress (ORSModel.ors.Progress) –
-
setROI(self, index: int, aVolROI: ORSModel.ors.ROI) → None¶ Fills a particularROI slot to be used as a source for the Dijkstra algorithm.
Note
A maximum of 10 ROIs can be provided. The ROIs provided must be of the same shape as the input channel.
Parameters: - index (int) – the slot index (an unsigned char)
- aVolROI (ORSModel.ors.ROI) – the ROI associated with this slot index (an ROI)
-
setSigmaPow2(self, aLimit: float) → None¶ Sets the variance used by the gaussian used if the metric == 1.
Note
Only useful when metric is set to 1.
Parameters: aLimit (float) – variance of the gaussian (a double)
-
tracebackCPU(self, aROI: ORSModel.ors.ROI, linputChannelTraceBack: ORSModel.ors.Channel, aPath: ORSModel.ors.VisualPath) → None¶ Uses a traceback channel to fill a path from aROI to the nearest source ROI.
Parameters: - aROI (ORSModel.ors.ROI) – a trace back start (an ROI)
- linputChannelTraceBack (ORSModel.ors.Channel) – a trace back channel (an ROI)
- aPath (ORSModel.ors.VisualPath) –
-
updateDistanceMapForMaxDistance(self, lOutputChannelDistanceMap: ORSModel.ors.Channel, maxDistance: float, lOutputChannelTraceBack: ORSModel.ors.Channel, lOutputChannelLabel: ORSModel.ors.Channel) → None¶ Parameters: - lOutputChannelDistanceMap (ORSModel.ors.Channel) –
- maxDistance (float) –
- lOutputChannelTraceBack (ORSModel.ors.Channel) –
- lOutputChannelLabel (ORSModel.ors.Channel) –
-
Unmanaged¶
-
class
ORSModel.ors.Unmanaged Bases:
ORSModel.ors.ORSBaseClassbrief_description: Abstract class for objects that are not managed by the core library. author: Eric Fournier. All other members of ORS participated. version: 1.0 date: Jan 2005
-
atomicLoad(sFilename: str) → Unmanaged Creates an object from a file where an object was saved.
Parameters: sFilename (str) – path of the file to load Returns: output (Unmanaged) – a managed object, or none() if the load fails
-
atomicSave(self, aFilename: str) → int Saves the object to a file.
Parameters: aFilename (str) – path of the file to save Returns: output (int) – 0 if successful, otherwise an error code
-
createFromPythonRepresentation(aPythonRepresentation: str) → Unmanaged Create aUnmanaged Object from a python representation a static method.
Parameters: aPythonRepresentation (str) – Returns: output (ORSModel.ors.Unmanaged) –
-
fromPythonRepresentation(self, aPythonRepresentation: str) → bool Create aUnmanaged object from a Python string representation.
Parameters: aPythonRepresentation (str) – a Python evaluable string representation (a string) Returns: output (bool) – TRUE if parsing worked, FALSE otherwise (a bool)
-
classmethod
getAllSubclasses(outputCollection=None)
-
classmethod
getClassDenomination()
-
static
getClassFromProgId(progId)
-
getClassName(self) → str Retrieves the class name of the core object wrapped by this Interface object.
Returns: output (str) –
-
getClassNameStatic() → str getClassNameStatic
Returns: output (str) –
-
getDataChecksum(self) → str Returns: output (str) –
-
getIsInstanceOf(self, pProgId: str) → bool Queries the object to know if it is an instance of a certain class.
Parameters: pProgId (str) – Returns: output (bool) –
-
classmethod
getIsSubclassOf(parentClass)
-
getPythonRepresentation(self) → str Gets a Python evaluable string representation.
Returns: output (str) –
-
isNone(self) → bool Checks if the receiver is none.
Returns: output (bool) –
-
isNotNone(self) → bool Checks if the receiver is not none.
Returns: output (bool) –
-
none() → Unmanaged Returns: output (Unmanaged) –
-
ORSBaseClass¶
-
class
ORSModel.ors.ORSBaseClass brief_description: An abstract class from which all objects issued from the author: Eric Fournier. All other members of ORS participated. version: 1.0 date: Jan 2005
-
getPythonTraceBack() → typing.List[str] Set the python traceback for a call from python.
Returns: output (typing.List[str]) –
-
isManaged(self) → bool Returns: output (bool) –
-
isNone(self) → bool Returns: output (bool) –
-
setPythonTraceBack(tb: ORSModel.ors.typing.List[str]) → None Set the python traceback for a call from python.
Parameters: tb (typing.List[str]) –
-