Class AlgorithmVOIProps

  • All Implemented Interfaces:
    VOIStatisticList, java.awt.event.ActionListener, java.awt.event.WindowListener, java.lang.Runnable, java.util.EventListener

    public class AlgorithmVOIProps
    extends AlgorithmBase
    implements VOIStatisticList
    This class calculates a properties of an image defined by a VOI. Attributes include: volume, area, number of pixels, center of mass, average pixel intensity, standard deviation of intensity, eccentricity, principalAxis, coefficient of skewness, and coefficient of kurtosis.
    Version:
    0.1 Feb 11, 1998
    Author:
    Matthew J. McAuliffe, Ph.D. Calculates and prepares for display image statistics generated on closed VOI Contours. The contours can exist on any of the three orthogonal image slices. The user can select to display the contour statistics sorted by contour, contour and slice, slice (contours are summed over a slice), or by a total sum. Depending on the type of output selected by the user the contours are displayed with the following information tags: By contour : Name, ID By contour & slice: Name, orientation, slice, ID By slice only: Name, orientation; slice By total VOI: Name Most of the statistics are generated by iterating through the set of voxels that are contained within the closed contour. These statistic calculations take advantage of the information that is generated with the VOIBase.getMask() function and stored inside the VOIBase class. Because the information is generated once at the start of the calculation and stored, the performance for all statistic calculations is improved. When the VOIBase.getMask() function is called the following information is stored in the VOIBase class: BitSet mask of voxels inside the closed contour Vector list of voxel positions inside the closed contour Geometric Center of the contour. The following statistics can be derived directly from the stored information: -- number of voxels -- area -- volume -- min, max, sum, average intensity -- median, mode, mode count -- standard deviation, coefficient of skewness, coefficient of kurtosis, center of mass -- geometric center When the AlgorithmVOIProps is instantiated from a dialog, the user is able to select the statistics to calculate. The list of selected statistics is passed to the AlgorithmVOIProps and only the statistics requested by the user are calculated. When AlgorithmVOIProps is accessed through another algorithm, all statistics are automatically calculated. Median statistics (median, mode, mode count) are calculated in a function that takes the list of voxels as input, can be used on a single contour or on a group of contours. Standard deviation statistics are calculated in a function that takes the list of voxel positions, can be used on a single contour or on a group of contours.
    • Field Detail

      • smoothCurvature

        private boolean smoothCurvature
      • negativeHysteresisFraction

        private double negativeHysteresisFraction
      • positiveHysteresisFraction

        private double positiveHysteresisFraction
      • consecutiveNegativeNeeded

        private int consecutiveNegativeNeeded
      • negativeCurvatureNeeded

        private double negativeCurvatureNeeded
      • PROCESS_PER_VOI

        public static final int PROCESS_PER_VOI
        Algorithm sums all statistics for the entire VOI
        See Also:
        Constant Field Values
      • PROCESS_PER_SLICE_AND_CONTOUR

        public static final int PROCESS_PER_SLICE_AND_CONTOUR
        Algorithm maintains separate statistics per contour and denotes the slice of each contour
        See Also:
        Constant Field Values
      • PROCESS_PER_SLICE

        public static final int PROCESS_PER_SLICE
        Algorithm sums all statistics from each contour on the same slice
        See Also:
        Constant Field Values
      • PROCESS_PER_CONTOUR

        public static final int PROCESS_PER_CONTOUR
        Algorithm maintains separate statistics per contour
        See Also:
        Constant Field Values
      • activeVOI

        private VOI activeVOI
        The VOI on which to perform the calculations.
      • nf

        protected java.text.DecimalFormat nf
        Formatting for float values into strings.
      • nfe

        protected java.text.DecimalFormat nfe
      • processType

        protected int processType
        How the VOI calculations should be performed (entire, contour, slice).
      • propertyList

        protected java.util.Vector<VOIStatisticalProperties> propertyList
        Vector to hold all properties calculated within the algorithm for later access.
      • sliceDistanceFlag

        protected boolean sliceDistanceFlag
        Whether or not to calculate largest slice distance, true by default
      • distanceFlag

        protected boolean distanceFlag
        Whether or not to calculate largest distance (only 3D), true by default
      • selectedVOIset

        protected ViewVOIVector selectedVOIset
        Vector of all VOIs that will have calculations performed.
      • showTotals

        protected boolean showTotals
        Whether or not to show totals for each calculation.
      • doOnlyActiveContours

        protected boolean doOnlyActiveContours
        Boolean for if the algorithm should ONLY check active contours
      • calcGroup

        private java.lang.ThreadGroup calcGroup
        The top-level group of threads used for calculating.
      • statsList

        protected boolean[] statsList
    • Constructor Detail

      • AlgorithmVOIProps

        public AlgorithmVOIProps​(ModelImage srcImg,
                                 int pType,
                                 JPanelPixelExclusionSelector.RangeType rangeFlag,
                                 ViewVOIVector voiSet)
        constructor. note that if there are no VOIs to act on, this constructor returns quietly.
        Parameters:
        srcImg - image model that contain the VOI
        pType - list of items to perform the statistics operations on
        rangeFlag - Whether the range of values specified by the statistics generator should be ignored
        voiSet - The VOIs that will be calculated
      • AlgorithmVOIProps

        public AlgorithmVOIProps​(ModelImage srcImg,
                                 int processType,
                                 ViewVOIVector voiSet)
        constructor.
        Parameters:
        srcImg - image model that contain the VOI
        processType - perform the property calculations for each slice, rather than for whole volume of interest
        voiSet - The VOIs that will be calculated
      • AlgorithmVOIProps

        public AlgorithmVOIProps​(ModelImage srcImg,
                                 ViewVOIVector voiSet)
        constructor. sets the source image of the algorithm, and presets the algorithm to calculate properties of 3D images as a volume of interest, rather than by slice.
        Parameters:
        srcImg - image model that contain the VOI
        voiSet - The VOIs that will be calculated
    • Method Detail

      • setSmoothCurvature

        public void setSmoothCurvature​(boolean smoothCurvature)
      • setNegativeHysteresisFraction

        public void setNegativeHysteresisFraction​(double negativeHysteresisFraction)
      • setPositiveHysteresisFraction

        public void setPositiveHysteresisFraction​(double positiveHysteresisFraction)
      • setConsecutiveNegativeNeeded

        public void setConsecutiveNegativeNeeded​(int consecutiveNegativeNeeded)
      • setNegativeCurvatureNeeded

        public void setNegativeCurvatureNeeded​(double negativeCurvatureNeeded)
      • finalize

        public void finalize()
        Prepares this class for destruction.
        Overrides:
        finalize in class AlgorithmBase
      • getArea

        public float getArea()
        Gets the area of the VOI; return area defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getSurfaceArea

        public float getSurfaceArea()
        Gets the surfaceArea of the VOI; return surfaceArea defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getAvgInten

        public float getAvgInten()
        Gets the average intensity of the VOI return average intensity of image defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getAvgIntenB

        public float getAvgIntenB()
        Gets the average intensity of the Blue channel of VOI return average intensity of the Blue channel of image defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getAvgIntenG

        public float getAvgIntenG()
        Gets the average intensity of the Green channel of VOI return average intensity of the Green channel of image defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getAvgIntenR

        public float getAvgIntenR()
        Gets the average intensity of the Red channel of VOI return average intensity of the Red channel of image defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getCenterOfMass

        public java.lang.String getCenterOfMass()
        Gets the the center of mass of the VOI ; return center of mass defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getCenterOfMassB

        public java.lang.String getCenterOfMassB()
        Gets the the blue center of mass of the VOI ; return blue center of mass defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getCenterOfMassG

        public java.lang.String getCenterOfMassG()
        Gets the the green center of mass of the VOI ; return green center of mass defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getCenterOfMassR

        public java.lang.String getCenterOfMassR()
        Gets the the red center of mass of the VOI ; return red center of mass defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getEccentricity

        public float getEccentricity()
        Gets the eccentricity of the VOI: 1 = line, 0 = circle; return eccentricity of the VOI.
        Returns:
        DOCUMENT ME!
      • getGeometricCenter

        public java.lang.String getGeometricCenter()
        Gets the the geometric center of the VOI ; return geometric center defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getKurtosis

        public float getKurtosis()
        Gets the coefficient of kurtosis of the pixel values in the VOI
        Returns:
      • getKurtosisB

        public float getKurtosisB()
        Gets the coefficient of kurtosis of the blue pixel values in the VOI
        Returns:
      • getKurtosisG

        public float getKurtosisG()
        Gets the coefficient of kurtosis of the green pixel values in the VOI
        Returns:
      • getKurtosisR

        public float getKurtosisR()
        Gets the coefficient of kurtosis of the red pixel values in the VOI
        Returns:
      • getLargestDistance

        public java.lang.String getLargestDistance()
        Gets the largest line segment totally contained within a 3D VOI (in terms of res). If this unexpectedly returns zero, make sure you have not inadvertently set distanceFlag to false.
        Returns:
        String largest distance string
      • getLargestSliceDistance

        public java.lang.String getLargestSliceDistance()
        Gets the largest line segment totally contained within a VOI slice (in terms of res). If this unexpectedly returns zero, make sure you have not inadvertently set sliceDistanceFlag to false.
        Returns:
        String largest slice distance string
      • getMajorAxis

        public float getMajorAxis()
        Gets the major axis of VOI (only valid for 2D object); return major axis length of the VOI.
        Returns:
        DOCUMENT ME!
      • getMaxIntensity

        public float getMaxIntensity()
        Gets the maximum intensity of the VOI return average intensity of image defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getMaxIntensityBlue

        public float getMaxIntensityBlue()
        Gets the maximum intensity of the Blue channel for the VOI return average intensity of image defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getMaxIntensityGreen

        public float getMaxIntensityGreen()
        Gets the maximum intensity of the Green channel for the VOI return average intensity of image defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getMaxIntensityRed

        public float getMaxIntensityRed()
        Gets the maximum intensity of the Red channel for the VOI return average intensity of image defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getMedian

        public float getMedian()
        Gets the median
        Returns:
        DOCUMENT ME!
      • getMedianB

        public float getMedianB()
        Gets the median of the Blue channel of image defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getMedianG

        public float getMedianG()
        Gets the median of the Green channel of image defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getMedianR

        public float getMedianR()
        Gets the median of the Red channel of image defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getMinIntensity

        public float getMinIntensity()
        Gets the minimum intensity of the VOI return average intensity of image defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getMinIntensityBlue

        public float getMinIntensityBlue()
        Gets the minimum intensity of the Blue channel for the VOI return average intensity of image defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getMinIntensityGreen

        public float getMinIntensityGreen()
        Gets the minimum intensity of the Green channel for the VOI return average intensity of image defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getMinIntensityRed

        public float getMinIntensityRed()
        Gets the minimum intensity of the Red channel for the VOI return average intensity of image defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getMinorAxis

        public float getMinorAxis()
        Gets the minor axis of VOI (only valid for 2D object); return minor axis length of the VOI.
        Returns:
        DOCUMENT ME!
      • getMode

        public float getMode()
        Gets the mode
        Returns:
        DOCUMENT ME!
      • getModeB

        public float getModeB()
        Gets the mode of the Blue channel of image defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getModeCount

        public int getModeCount()
        Gets the mode
        Returns:
        DOCUMENT ME!
      • getModeCountB

        public int getModeCountB()
        Gets the mode of the Blue channel of image defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getModeCountG

        public int getModeCountG()
        Gets the mode of the Green channel of image defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getModeCountR

        public int getModeCountR()
        Gets the mode of the Red channel of image defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getModeG

        public float getModeG()
        Gets the mode of the Green channel of image defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getModeR

        public float getModeR()
        Gets the mode of the Red channel of image defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getNVoxels

        public int getNVoxels()
        Gets the the number of pixels return number of pixels defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getPerimeter

        public java.lang.String getPerimeter()
        Gets the perimeter of the VOI (in terms of res).
        Returns:
        String perimeter string
      • getCircularity

        public java.lang.String getCircularity()
        Gets the circularity of the VOI.
        Returns:
        String circularity string
      • getSolidity

        public java.lang.String getSolidity()
        Gets the solidity of the VOI.
        Returns:
        String solidity string
      • getNumberOfIndentationsCurvture

        public java.lang.String getNumberOfIndentationsCurvture()
      • getNumberOfIndentationsHull

        public java.lang.String getNumberOfIndentationsHull()
      • getMeanCurvature

        public java.lang.String getMeanCurvature()
        Returns:
      • getStdDevCurvature

        public java.lang.String getStdDevCurvature()
        Returns:
      • getMeanNegativeCurvature

        public java.lang.String getMeanNegativeCurvature()
        Returns:
      • getAsymmetryIndex

        public java.lang.String getAsymmetryIndex()
      • getPrincipalAxis

        public float getPrincipalAxis()
        Gets the principle axis of VOI (only valid for 2D object); return pricipal axis angle of the VOI.
        Returns:
        DOCUMENT ME!
      • getFractalDimensionBoxCount

        public double getFractalDimensionBoxCount()
      • getFractalDimensionEuclideanDistance

        public double getFractalDimensionEuclideanDistance()
      • getProcessType

        public int getProcessType()
        Reports if algorithm is performing calcs per slice, per contour, or for entire VOI.
        Returns:
        processType (int for process type)
      • getScannerPositionLabels

        public java.lang.String[] getScannerPositionLabels​(WildMagic.LibFoundation.Mathematics.Vector3f position)
        Gets position data to display in message bar - for DICOM and MINC images, gives patient position as well. The image's associated transformation must be FileInfoBase.TRANSFORM_SCANNER_ANATOMICAL, or the orientations must be set up correctly, or else the function returns null.
        Parameters:
        image - The image the point lies within.
        position - (x,y,z(slice)) position in FileCoordinates
        Returns:
        An array of strings that represent patient position.
      • getSkewness

        public float getSkewness()
        Gets the coefficient of skewness of the pixel values in the VOI
        Returns:
      • getSkewnessB

        public float getSkewnessB()
        Gets the coefficient of skewness of the blue pixel values in the VOI
        Returns:
      • getSkewnessG

        public float getSkewnessG()
        Gets the coefficient of skewness of the green pixel values in the VOI
        Returns:
      • getSkewnessR

        public float getSkewnessR()
        Gets the coefficient of skewness of the red pixel values in the VOI
        Returns:
      • getStdDev

        public float getStdDev()
        Gets the standard deviation of image intensities return standard deviation of image intensities defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getStdDevB

        public float getStdDevB()
        Gets the get standard deviation of image intensities (blue channel) return standard deviation of image intensities defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getStdDevG

        public float getStdDevG()
        Gets the standard deviation of image intensities (green channel) return standard deviation of image intensities defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getStdDevR

        public float getStdDevR()
        Gets the standard deviation of image intensities (red channel) return standard deviation of image intensities defined by the VOI.
        Returns:
        DOCUMENT ME!
      • getSumIntensities

        public float getSumIntensities()
        Gets the sum of image intensities defined by the VOI
        Returns:
      • getSumIntensitiesB

        public float getSumIntensitiesB()
        Gets the sum of blue channel mage intensities defined by the VOI
        Returns:
      • getSumIntensitiesG

        public float getSumIntensitiesG()
        Gets the sum of green channel image intensities defined by the VOI
        Returns:
      • getSumIntensitiesR

        public float getSumIntensitiesR()
        Gets the sum of red channel image intensities defined by the VOI
        Returns:
      • getVOIProperties

        public VOIStatisticalProperties getVOIProperties​(VOI aVOI)
        DOCUMENT ME!
        Parameters:
        aVOI - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • getVolume

        public float getVolume()
        Gets the volume of the VOI; return volume defined by the VOI.
        Returns:
        DOCUMENT ME!
      • isColor

        public boolean isColor()
        Accessor that indicates if the source image is a color image.
        Returns:
        true if the image is a color image.
      • makeStatisticListDescriptions

        public java.lang.String[] makeStatisticListDescriptions()
        Creates the list of labels to use in the checkboxes.
        Returns:
        DOCUMENT ME!
      • runAlgorithm

        public void runAlgorithm()
        Begins execution of the software.
        Specified by:
        runAlgorithm in class AlgorithmBase
      • setDistanceFlag

        public void setDistanceFlag​(boolean distanceFlag)
        Sets whether the largest distance is calculated. Defaults to true, set to false if VOI will not complete.
        Parameters:
        distanceFlag -
      • setDoOnlyActiveContours

        public void setDoOnlyActiveContours​(boolean doActive)
        Sets the flag for calculating totals ONLY for active contours
        Parameters:
        doActive -
      • setPrecisionDisplay

        public void setPrecisionDisplay​(int numDecimal,
                                        boolean doForce)
        Sets the String float formatter to trim to numDecimal number of decimals.
        Parameters:
        numDecimal - int number of decimals
        doForce - boolean force numDecimal or allow zero
      • setSelectedStatistics

        public void setSelectedStatistics​(boolean[] checkList)
        Sets the list of selected statistics to calculate. Default is to calculate all statistics.
        Parameters:
        checkList -
      • setSelectedVOI

        public void setSelectedVOI​(VOI aVOI)
        DOCUMENT ME!
        Parameters:
        aVOI - DOCUMENT ME!
      • setShowTotals

        public void setShowTotals​(boolean totals)
        tells the algorithm to total the property calculations.
        Parameters:
        totals - DOCUMENT ME!
      • setSliceDistanceFlag

        public void setSliceDistanceFlag​(boolean sliceDistanceFlag)
        Sets whether the largest slice distance is calculated. Defaults to true, set to false if VOI will not complete.
        Parameters:
        sliceDistanceFlag -
      • setVOIList

        public void setVOIList​(javax.swing.ListModel list)
        DOCUMENT ME!
        Parameters:
        list - DOCUMENT ME!
      • setVOIList

        public void setVOIList​(ViewVOIVector vvv)
        sets the selected VOIset and the data set data storage sizes based on the number of curves in the Vector.
        Parameters:
        vvv - DOCUMENT ME!
      • getVOIList

        public ViewVOIVector getVOIList()
        gets the selected VOIset
        Parameters:
        vvv - DOCUMENT ME!
      • addScannerLabels

        protected java.lang.String addScannerLabels​(java.lang.String baseString,
                                                    WildMagic.LibFoundation.Mathematics.Vector3f currentPt)
        DOCUMENT ME!
        Parameters:
        leadBase - DOCUMENT ME!
      • indexOf

        protected int indexOf​(java.lang.String statistic)
      • initialiseDataHolders

        private void initialiseDataHolders​(int numberOfVOIs)
        DOCUMENT ME!
        Parameters:
        numberOfVOIs - DOCUMENT ME!