Class AlgorithmVOIProps.Calc34D

  • All Implemented Interfaces:
    java.lang.Runnable
    Enclosing class:
    AlgorithmVOIProps

    private class AlgorithmVOIProps.Calc34D
    extends java.lang.Object
    implements java.lang.Runnable
    • Field Detail

      • calcSelectedVOI

        private VOI calcSelectedVOI
        The VOI being used just for this calculation (may be a single curve of a single slice or entire VOI
    • Constructor Detail

      • Calc34D

        public Calc34D​(VOI selectedVOI)
    • Method Detail

      • getMedianStatistics

        public void getMedianStatistics​(AlgorithmVOIProps.Calc34D.ContourStats stats)
        Calculates the median statistics for a grayscale image. The image data is stored in the input stats.values. This function can be used for a single contour or a group of contours.
        Parameters:
        stats - contains the Vector of voxels inside the contour(s) used to calculate the median, mode and mode count.
      • getMedianStatisticsRGB

        public void getMedianStatisticsRGB​(AlgorithmVOIProps.Calc34D.ContourStats stats)
        Calculates the median statistics for a color image. The image data is stored in the input stats.valuesRGB. This function can be used for a single contour or a group of contours.
        Parameters:
        stats - contains the Vector of voxels inside the contour(s) used to calculate the median, mode and mode count.
      • getStdSkewStatistics

        public void getStdSkewStatistics​(AlgorithmVOIProps.Calc34D.ContourStats stats,
                                         java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f> kPositions,
                                         java.lang.String unit2DStr,
                                         java.lang.String unit3DStr,
                                         float ignoreMin,
                                         float ignoreMax)
        Calculates the standard deviation, coefficient of skewness, coefficient of kurtosis and center of mass for a grayscale image.
        Parameters:
        stats - output values are written into stats.
        kPositions - list of positions of voxels inside the contour (or multiple contours).
        unit2DStr - , 2D label string
        unit3DStr - , 3D label string
        ignoreMin - , threshold minimum
        ignoreMax - , threshold maximum
      • getStdSkewStatisticsRGB

        public void getStdSkewStatisticsRGB​(AlgorithmVOIProps.Calc34D.ContourStats stats,
                                            java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f> kPositions,
                                            java.lang.String unit2DStr,
                                            java.lang.String unit3DStr,
                                            float ignoreMinR,
                                            float ignoreMaxR,
                                            float ignoreMinG,
                                            float ignoreMaxG,
                                            float ignoreMinB,
                                            float ignoreMaxB)
        Calculates the standard deviation, coefficient of skewness, coefficient of kurtosis and center of mass for a color image.
        Parameters:
        stats - output values are written into stats.
        kPositions - list of positions of voxels inside the contour (or multiple contours).
        unit2DStr - , 2D label string
        unit3DStr - , 3D label string
        ignoreMinR - , threshold minimum red
        ignoreMaxR - , threshold maximum red
        ignoreMinG - , threshold minimum green
        ignoreMaxG - , threshold maximum green
        ignoreMinB - , threshold minimum blue
        ignoreMaxB - , threshold maximum blue
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • calcStatsPerContour

        private AlgorithmVOIProps.Calc34D.ContourStats calcStatsPerContour​(FileInfoBase fileInfo,
                                                                           VOIBase contour,
                                                                           int orientation,
                                                                           java.lang.String unit2DStr,
                                                                           java.lang.String unit3DStr,
                                                                           float ignoreMin,
                                                                           float ignoreMax,
                                                                           VOIStatisticalProperties statProperty,
                                                                           int iSlice,
                                                                           int iID)
        Calculates statistics for a single contour. Calculations are done on an as-needed basis for faster performance.
        Parameters:
        fileInfo - information on image resolutions and dimensions
        contour - input contour
        orientation - the image plane the contour is on
        unit2DStr - 2D label string
        unit3DStr - 3D label string
        ignoreMin - threshold minimum
        ignoreMax - threshold maximum
        statProperty - output labels are written to statProperty
        iSlice - contour slice
        iID - contour iD
        Returns:
        ContourStats data structure contains the statistic values.
      • calcStatsPerContourRGB

        private AlgorithmVOIProps.Calc34D.ContourStats calcStatsPerContourRGB​(FileInfoBase fileInfo,
                                                                              VOIBase contour,
                                                                              int orientation,
                                                                              java.lang.String unit2DStr,
                                                                              java.lang.String unit3DStr,
                                                                              float ignoreMinR,
                                                                              float ignoreMaxR,
                                                                              float ignoreMinG,
                                                                              float ignoreMaxG,
                                                                              float ignoreMinB,
                                                                              float ignoreMaxB,
                                                                              VOIStatisticalProperties statProperty,
                                                                              int iSlice,
                                                                              int iID)
        Calculates statistics for a single contour. Calculations are done on an as-needed basis for faster performance.
        Parameters:
        fileInfo - information on image resolutions and dimensions
        contour - input contour
        orientation - the image plane the contour is on
        unit2DStr - 2D label string
        unit3DStr - 3D label string
        ignoreMinR - threshold minimum red
        ignoreMaxR - threshold maximum red
        ignoreMinG - threshold minimum green
        ignoreMaxG - threshold maximum green
        ignoreMinB - threshold minimum blue
        ignoreMaxB - threshold maximum blue
        statProperty - output labels are written to statProperty
        iSlice - contour slice
        iID - contour iD
        Returns:
        ContourStats data structure contains the statistic values.
      • calcStatsTotal

        private void calcStatsTotal​(VOI kVOI,
                                    VOIStatisticalProperties statProperty,
                                    FileInfoBase fileInfo,
                                    java.lang.String unit2DStr,
                                    java.lang.String unit3DStr,
                                    float ignoreMin,
                                    float ignoreMax)
        Calculates the statistics for the VOI as a whole (across all contours within the VOI). Calculations are done on an as-needed basis for faster performance.
        Parameters:
        contours - list of contours in the VOI
        statProperty - stores the calculated output
        fileInfo - information for image resolutions
        unit2DStr - 2D label string
        unit3DStr - 3D label string
        ignoreMin - threshold minimum
        ignoreMax - threshold maximum
        largestDistance - largest Distance in the VOI. private void calcStatsTotal( Vector contours, VOIStatisticalProperties statProperty, FileInfoBase fileInfo, String unit2DStr, String unit3DStr, float ignoreMin, float ignoreMax, double largestDistance ) { ContourStats stats = new ContourStats(); // The following depend on each other: quantityDescription, volumeDescription, areaDescription, // circularityDescription, solidityDescription // If one is selected, all are calculated. if ( statsList[ indexOf( quantityDescription ) ] || statsList[ indexOf( volumeDescription ) ] || statsList[ indexOf( areaDescription ) ] || statsList[ indexOf( circularityDescription)] || statsList[ indexOf( solidityDescription)]) { stats.nVox = 0; stats.area = 0; stats.volume = 0; for ( int i = 0; i = 0; i = convexMask.nextSetBit(i+1)) { fVal = srcImage.getFloat(i); if (MipavUtil.inRange(ignoreMin, ignoreMax, fVal, rangeFlag)) { convexMask.set(i, false); } } } convexStats.nVox = convexMask.cardinality(); convexStats.area = convexStats.nVox * (fileInfo.getResolutions()[0] * fileInfo.getResolutions()[1]); stats.solidity = stats.area/convexStats.area; statProperty.setProperty(VOIStatisticList.solidityDescription, nf.format(stats.solidity)); } if (statsList[indexOf(numberOfIndentationsDescription)]) { stats.numberOfIndentations = contour.findVOIIndentations2D(srcImage, iSlice, null, false); statProperty.setProperty(VOIStatisticList.numberOfIndentationsDescription + end, nf.format(stats.numberOfIndentations)); } if (statsList[indexOf(meanCurvatureDescription)] || statsList[indexOf(stdDevCurvatureDescription)] || statsList[indexOf(meanNegativeCurvatureDescription)]) { Vector positions = new Vector(); Vector curvature = new Vector(); double meanCurvature[] = new double[1]; double stdDevCurvature[] = new double[1]; double meanNegativeCurvature[] = new double[1]; boolean smooth = true; VOIBase convexContour = new VOIContour((VOIContour)contour); convexContour.findPositionAndCurvature( srcImage, positions, curvature, smooth, meanCurvature, stdDevCurvature, meanNegativeCurvature); if (statsList[indexOf(meanCurvatureDescription)]) { stats.meanCurvature = meanCurvature[0]; statProperty.setProperty(VOIStatisticList.meanCurvatureDescription + end, nf.format(stats.meanCurvature)); } if (statsList[indexOf(stdDevCurvatureDescription)]) { stats.stdDevCurvature = stdDevCurvature[0]; statProperty.setProperty(VOIStatisticList.stdDevCurvatureDescription + end, nf.format(stats.stdDevCurvature)); } if (statsList[indexOf(meanNegativeCurvatureDescription)]) { stats.meanNegativeCurvature = meanNegativeCurvature[0]; statProperty.setProperty(VOIStatisticList.meanNegativeCurvatureDescription + end, nf.format(stats.meanNegativeCurvature)); } } // The following statistics are derived from the minIntensity, maxIntensity, avgIntensity, and sumIntensity: // median, mode, modeCount // deviationDescription, skewnessDescription, kurtosisDescription, massCenterDescription if ( statsList[ indexOf( minIntensity ) ] || statsList[ indexOf( maxIntensity ) ] || statsList[ indexOf( avgIntensity ) ] || statsList[ indexOf( sumIntensities ) ] || statsList[ indexOf( median ) ] || statsList[ indexOf( mode ) ] || statsList[ indexOf( modeCount ) ] || statsList[ indexOf( deviationDescription ) ] || statsList[ indexOf( skewnessDescription ) ] || statsList[ indexOf( kurtosisDescription ) ] || statsList[ indexOf( massCenterDescription ) ] ) { stats.nVox = 0; stats.values = new Vector(); stats.valuesRGB = new Vector(); for ( int i = 0; i kPositions = new Vector(); for ( int i = 0; i 2) { selectedCOM.Z *= srcImage.getFileInfo(0).getResolutions()[2]; unitStr = unit3DStr; } String comStr = unitStr + "\n\t\t" + nf.format(selectedCOM.X) + "\t" + nf.format(selectedCOM.Y) + "\t" + nf.format(selectedCOM.Z); comStr = addScannerLabels(comStr, selectedCOM); stats.gCenterString = new String(comStr); statProperty.setProperty(VOIStatisticList.geometricCenterDescription, stats.gCenterString); } // If user selects largestSliceDistanceDescription: if ( statsList[ indexOf( largestSliceDistanceDescription ) ] ) { for ( int i = 0; i
      • calcStatsTotalRGB

        private void calcStatsTotalRGB​(VOI kVOI,
                                       VOIStatisticalProperties statProperty,
                                       FileInfoBase fileInfo,
                                       java.lang.String unit2DStr,
                                       java.lang.String unit3DStr,
                                       float ignoreMinR,
                                       float ignoreMaxR,
                                       float ignoreMinG,
                                       float ignoreMaxG,
                                       float ignoreMinB,
                                       float ignoreMaxB)
      • printTotals

        private void printTotals​(AlgorithmVOIProps.Calc34D.ContourStats[] stats,
                                 VOIStatisticalProperties statProperty,
                                 java.lang.String unit2DStr,
                                 java.lang.String unit3DStr,
                                 java.lang.String end,
                                 float ignoreMin,
                                 float ignoreMax,
                                 double largestDistance)
        Sums the statistics for a group of contours, where the statistics are first calculated per-contour.
        Parameters:
        stats - array of per-contour statistics
        statProperty - output is written to the statProperty
        unit2DStr - 2D label string
        unit3DStr - 3D label string
        end - tag for statProperty labels
        ignoreMin - threshold minimum
        ignoreMax - threshold maximum
        largestDistance - VOI largest distance.
      • printTotalsRGB

        private void printTotalsRGB​(AlgorithmVOIProps.Calc34D.ContourStats[] stats,
                                    VOIStatisticalProperties statProperty,
                                    java.lang.String unit2DStr,
                                    java.lang.String unit3DStr,
                                    java.lang.String end,
                                    float ignoreMinR,
                                    float ignoreMaxR,
                                    float ignoreMinG,
                                    float ignoreMaxG,
                                    float ignoreMinB,
                                    float ignoreMaxB,
                                    double largestDistance)
        Sums the statistics for a group of contours, where the statistics are first calculated per-contour.
        Parameters:
        stats - array of per-contour statistics
        statProperty - output is written to the statProperty
        unit2DStr - 2D label string
        unit3DStr - 3D label string
        end - tag for statProperty labels
        ignoreMinR - threshold minimum red
        ignoreMaxR - threshold maximum red
        ignoreMinG - threshold minimum green
        ignoreMaxG - threshold maximum green
        ignoreMinB - threshold minimum blue
        ignoreMaxB - threshold maximum blue
        largestDistance - VOI largest distance.
      • printTotals

        private void printTotals​(java.util.Vector<AlgorithmVOIProps.Calc34D.ContourStats> allStats,
                                 VOIStatisticalProperties statProperty,
                                 java.lang.String unit2DStr,
                                 java.lang.String unit3DStr,
                                 java.lang.String end,
                                 float ignoreMin,
                                 float ignoreMax,
                                 double largestDistance)
        Sums the statistics for a group of contours, where the statistics are first calculated per-contour.
        Parameters:
        allStats - list of per-contour statistics
        statProperty - output is written to the statProperty
        unit2DStr - 2D label string
        unit3DStr - 3D label string
        end - tag for statProperty labels
        ignoreMin - threshold minimum
        ignoreMax - threshold maximum
        largestDistance - VOI largest distance.
      • printTotalsRGB

        private void printTotalsRGB​(java.util.Vector<AlgorithmVOIProps.Calc34D.ContourStats> allStats,
                                    VOIStatisticalProperties statProperty,
                                    java.lang.String unit2DStr,
                                    java.lang.String unit3DStr,
                                    java.lang.String end,
                                    float ignoreMinR,
                                    float ignoreMaxR,
                                    float ignoreMinG,
                                    float ignoreMaxG,
                                    float ignoreMinB,
                                    float ignoreMaxB,
                                    double largestDistance)
        Sums the statistics for a group of contours, where the statistics are first calculated per-contour.
        Parameters:
        allStats - list of per-contour statistics
        statProperty - output is written to the statProperty
        unit2DStr - 2D label string
        unit3DStr - 3D label string
        end - tag for statProperty labels
        ignoreMinR - threshold minimum red
        ignoreMaxR - threshold maximum red
        ignoreMinG - threshold minimum green
        ignoreMaxG - threshold maximum green
        ignoreMinB - threshold minimum blue
        ignoreMaxB - threshold maximum blue
        largestDistance - VOI largest distance.