Package gov.nih.mipav.model.algorithms
Class AlgorithmVOIProps.Calc34D
- java.lang.Object
-
- gov.nih.mipav.model.algorithms.AlgorithmVOIProps.Calc34D
-
- All Implemented Interfaces:
java.lang.Runnable
- Enclosing class:
- AlgorithmVOIProps
private class AlgorithmVOIProps.Calc34D extends java.lang.Object implements java.lang.Runnable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
AlgorithmVOIProps.Calc34D.ContourStats
Stores the statistics for a single contour, color or grayscale.
-
Field Summary
Fields Modifier and Type Field Description private VOI
calcSelectedVOI
The VOI being used just for this calculation (may be a single curve of a single slice or entire VOI
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.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.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).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)
void
getMedianStatistics(AlgorithmVOIProps.Calc34D.ContourStats stats)
Calculates the median statistics for a grayscale image.void
getMedianStatisticsRGB(AlgorithmVOIProps.Calc34D.ContourStats stats)
Calculates the median statistics for a color image.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.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.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.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.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.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.void
run()
-
-
-
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 Vectorof 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 Vectorof 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 stringunit3DStr
- , 3D label stringignoreMin
- , threshold minimumignoreMax
- , 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 stringunit3DStr
- , 3D label stringignoreMinR
- , threshold minimum redignoreMaxR
- , threshold maximum redignoreMinG
- , threshold minimum greenignoreMaxG
- , threshold maximum greenignoreMinB
- , threshold minimum blueignoreMaxB
- , threshold maximum blue
-
run
public void run()
- Specified by:
run
in interfacejava.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 dimensionscontour
- input contourorientation
- the image plane the contour is onunit2DStr
- 2D label stringunit3DStr
- 3D label stringignoreMin
- threshold minimumignoreMax
- threshold maximumstatProperty
- output labels are written to statPropertyiSlice
- contour sliceiID
- 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 dimensionscontour
- input contourorientation
- the image plane the contour is onunit2DStr
- 2D label stringunit3DStr
- 3D label stringignoreMinR
- threshold minimum redignoreMaxR
- threshold maximum redignoreMinG
- threshold minimum greenignoreMaxG
- threshold maximum greenignoreMinB
- threshold minimum blueignoreMaxB
- threshold maximum bluestatProperty
- output labels are written to statPropertyiSlice
- contour sliceiID
- 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 VOIstatProperty
- stores the calculated outputfileInfo
- information for image resolutionsunit2DStr
- 2D label stringunit3DStr
- 3D label stringignoreMin
- threshold minimumignoreMax
- threshold maximumlargestDistance
- largest Distance in the VOI. private void calcStatsTotal( Vectorcontours, 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 < contours.size(); i++ ) { int nVox = contours.elementAt(i).getNumVoxels(); stats.nVox += nVox; stats.area += nVox * (fileInfo.getResolutions()[0] * fileInfo.getResolutions()[1]); stats.volume += nVox * (fileInfo.getResolutions()[0] * fileInfo.getResolutions()[1] * fileInfo.getResolutions()[2]); } statProperty.setProperty(VOIStatisticList.areaDescription, nf.format(stats.area)); statProperty.setProperty(VOIStatisticList.volumeDescription, nf.format(stats.volume)); statProperty.setProperty(VOIStatisticList.quantityDescription, nf.format(stats.nVox)); } // If user selects perimeterDescription or circularityDescription: if ( statsList[ indexOf( perimeterDescription ) ] || statsList [ indexOf (circularityDescription) ]) { stats.perimeter = 0; for ( int i = 0; i < contours.size(); i++ ) { stats.perimeter += contours.elementAt(i).getLengthPtToPt(srcImage.getFileInfo(0).getResolutions()); } statProperty.setProperty(VOIStatisticList.perimeterDescription, nf.format(stats.perimeter)); } if ( statsList[indexOf(circularityDescription)]) { stats.circularity = (4.0 * Math.PI * stats.area)/(stats.perimeter * stats.perimeter); statProperty.setProperty(VOIStatisticList.circularityDescription + end, nf.format(stats.circularity)); } if ( statsList[indexOf(solidityDescription)]) { VOI convexKVOI = (VOI)kVOI.clone(); for ( int i = 0; i < convexKVOI.getCurves().size(); i++) { ((VOIContour)convexKVOI.getCurves().elementAt(i)).convexHull(); } ContourStats convexStats = new ContourStats(); BitSet convexMask = new BitSet( xDim * yDim * zDim ); convexKVOI.createBinaryMask3D(convexMask, xDim, yDim, false, false); if(rangeFlag != RangeType.NO_RANGE && rangeFlag != null) { //some intensity values need to be ignored in relevant calculations float fVal = 0.0f; for (int i = convexMask.nextSetBit(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 < contours.size(); i++ ) { int nVox = contours.elementAt(i).getNumVoxels(); stats.nVox += nVox; if (srcImage.isColorImage()) { ColorRGB kMin = new ColorRGB(); ColorRGB kMax = new ColorRGB(); ColorRGB kSum = new ColorRGB(); stats.valuesRGB.addAll( contours.elementAt(i).calcRGBIntensity( srcImage, kMin, kMax, kSum, ignoreMin, ignoreMax, rangeFlag ) ); if ( i == 0 ) { stats.minIntenRed = kMin.R; stats.minIntenGreen = kMin.G; stats.minIntenBlue = kMin.B; stats.maxIntenRed = kMax.R; stats.maxIntenGreen = kMax.G; stats.maxIntenBlue = kMax.B; } stats.minIntenRed = Math.min( stats.minIntenRed, kMin.R ); stats.minIntenGreen = Math.min( stats.minIntenGreen, kMin.G ); stats.minIntenBlue = Math.min( stats.minIntenBlue, kMin.B ); stats.maxIntenRed = Math.max( stats.minIntenRed, kMax.R ); stats.maxIntenGreen = Math.max( stats.minIntenGreen, kMax.G ); stats.maxIntenBlue = Math.max( stats.minIntenBlue, kMax.B ); stats.sumR += kSum.R; stats.sumG += kSum.G; stats.sumB += kSum.B; } else { Vector3f kMinMax = new Vector3f(); stats.values.addAll( contours.elementAt(i).calcIntensity( srcImage, kMinMax, ignoreMin, ignoreMax, rangeFlag ) ); if ( i == 0 ) { stats.minIntensity = kMinMax.X; stats.maxIntensity = kMinMax.Y; } stats.minIntensity = Math.min( stats.minIntensity, kMinMax.X ); stats.maxIntensity = Math.max( stats.maxIntensity, kMinMax.Y ); stats.sum += kMinMax.Z; } } statProperty.setProperty(VOIStatisticList.quantityDescription, nf.format(stats.nVox)); if (srcImage.isColorImage()) { stats.avgIntenR = stats.sumR/stats.nVox; stats.avgIntenG = stats.sumG/stats.nVox; stats.avgIntenB = stats.sumB/stats.nVox; statProperty.setProperty(VOIStatisticList.minIntensity + "Red", nf.format(stats.minIntenRed)); statProperty.setProperty(VOIStatisticList.maxIntensity + "Red", nf.format(stats.maxIntenRed)); statProperty.setProperty(VOIStatisticList.minIntensity + "Green", nf.format(stats.minIntenGreen)); statProperty.setProperty(VOIStatisticList.maxIntensity + "Green", nf.format(stats.maxIntenGreen)); statProperty.setProperty(VOIStatisticList.minIntensity + "Blue", nf.format(stats.minIntenBlue)); statProperty.setProperty(VOIStatisticList.maxIntensity + "Blue", nf.format(stats.maxIntenBlue)); statProperty.setProperty(VOIStatisticList.avgIntensity + "Red", nf.format(stats.avgIntenR)); statProperty.setProperty(VOIStatisticList.avgIntensity + "Green", nf.format(stats.avgIntenG)); statProperty.setProperty(VOIStatisticList.avgIntensity + "Blue", nf.format(stats.avgIntenB)); statProperty.setProperty(VOIStatisticList.sumIntensities + "Red", nf.format(stats.sumR)); statProperty.setProperty(VOIStatisticList.sumIntensities + "Green", nf.format(stats.sumG)); statProperty.setProperty(VOIStatisticList.sumIntensities + "Blue", nf.format(stats.sumB)); } else { stats.avgInten = stats.sum/stats.nVox; statProperty.setProperty(VOIStatisticList.minIntensity, nf.format(stats.minIntensity)); statProperty.setProperty(VOIStatisticList.maxIntensity, nf.format(stats.maxIntensity)); statProperty.setProperty(VOIStatisticList.avgIntensity, nf.format(stats.avgInten)); statProperty.setProperty(VOIStatisticList.sumIntensities, nf.format(stats.sum)); } // median, mode, modeCount if ( statsList[ indexOf( median ) ] || statsList[ indexOf( mode ) ] || statsList[ indexOf( modeCount ) ] ) { if (srcImage.isColorImage()) { getMedianStatisticsRGB( stats ); statProperty.setProperty(VOIStatisticList.mode + "Red", nf.format(stats.modeR)); statProperty.setProperty(VOIStatisticList.mode + "Green", nf.format(stats.modeG)); statProperty.setProperty(VOIStatisticList.mode + "Blue", nf.format(stats.modeB)); statProperty.setProperty(VOIStatisticList.modeCount + "Red", nf.format(stats.maxCountR)); statProperty.setProperty(VOIStatisticList.modeCount + "Green", nf.format(stats.maxCountG)); statProperty.setProperty(VOIStatisticList.modeCount + "Blue", nf.format(stats.maxCountB)); statProperty.setProperty(VOIStatisticList.median + "Red", nf.format(stats.medianR)); statProperty.setProperty(VOIStatisticList.median + "Green", nf.format(stats.medianG)); statProperty.setProperty(VOIStatisticList.median + "Blue", nf.format(stats.medianB)); } else { getMedianStatistics( stats ); statProperty.setProperty(VOIStatisticList.mode, nf.format(stats.mode)); statProperty.setProperty(VOIStatisticList.modeCount, nf.format(stats.maxCount)); statProperty.setProperty(VOIStatisticList.median, nf.format(stats.median)); } } // deviationDescription, skewnessDescription, kurtosisDescription, massCenterDescription if ( statsList[ indexOf( deviationDescription ) ] || statsList[ indexOf( skewnessDescription ) ] || statsList[ indexOf( kurtosisDescription ) ] || statsList[ indexOf( massCenterDescription ) ] ) { Vector kPositions = new Vector (); for ( int i = 0; i < contours.size(); i++ ) { kPositions.addAll( contours.elementAt(i).getMaskPositions() ); } if (srcImage.isColorImage()) { getStdSkewStatisticsRGB(stats, kPositions, unit2DStr, unit3DStr, ignoreMin, ignoreMax); statProperty.setProperty(VOIStatisticList.deviationDescription + "Red", nf.format(stats.stdDevR)); statProperty.setProperty(VOIStatisticList.deviationDescription + "Green", nf.format(stats.stdDevG)); statProperty.setProperty(VOIStatisticList.deviationDescription + "Blue", nf.format(stats.stdDevB)); statProperty.setProperty(VOIStatisticList.skewnessDescription + "Red", nf.format(stats.skewnessR)); statProperty.setProperty(VOIStatisticList.skewnessDescription + "Green", nf.format(stats.skewnessG)); statProperty.setProperty(VOIStatisticList.skewnessDescription + "Blue", nf.format(stats.skewnessB)); statProperty.setProperty(VOIStatisticList.kurtosisDescription + "Red", nf.format(stats.kurtosisR)); statProperty.setProperty(VOIStatisticList.kurtosisDescription + "Green", nf.format(stats.kurtosisG)); statProperty.setProperty(VOIStatisticList.kurtosisDescription + "Blue", nf.format(stats.kurtosisB)); statProperty.setProperty(VOIStatisticList.massCenterDescription + "Red", stats.massCenterDescriptionR); statProperty.setProperty(VOIStatisticList.massCenterDescription + "Green", stats.massCenterDescriptionG); statProperty.setProperty(VOIStatisticList.massCenterDescription + "Blue", stats.massCenterDescriptionB); } else { getStdSkewStatistics(stats, kPositions, unit2DStr, unit3DStr, ignoreMin, ignoreMax); statProperty.setProperty(VOIStatisticList.deviationDescription, nf.format(stats.stdDev)); statProperty.setProperty(VOIStatisticList.skewnessDescription, nf.format(stats.skewness)); statProperty.setProperty(VOIStatisticList.kurtosisDescription , nf.format(stats.kurtosis)); statProperty.setProperty(VOIStatisticList.massCenterDescription, stats.massCenterDescription); } } } // If user selects geometricCenterDescription if ( statsList[ indexOf( geometricCenterDescription ) ] ) { Vector3f selectedCOM = calcSelectedVOI.getGeometricCenter(); selectedCOM.X *= srcImage.getFileInfo(0).getResolutions()[0]; selectedCOM.Y *= srcImage.getFileInfo(0).getResolutions()[1]; String unitStr = unit2DStr + "\tZ"; if (srcImage.getNDims() > 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 < contours.size(); i++ ) { Vector3f kPos1 = new Vector3f(); Vector3f kPos2 = new Vector3f(); if ( i == 0 ) { stats.largestContourDistance = ((VOIContour) (contours.elementAt(i))).calcLargestSliceDistance( fileInfo.getResolutions()[0], fileInfo.getResolutions()[1], kPos1, kPos2); // Uncomment the following to at the VOILine to the image: //VOILine kLine = new VOILine(); //kLine.add(kPos1); //kLine.add(kPos2); //VOI kVOI = new VOI( (short)srcImage.getVOIs().size(), "LargestDist", VOI.LINE, 0 ); //kVOI.importCurve(kLine); //srcImage.registerVOI(kVOI); } else { stats.largestContourDistance = Math.max( stats.largestContourDistance, ((VOIContour) (contours.elementAt(i))).calcLargestSliceDistance( fileInfo.getResolutions()[0], fileInfo.getResolutions()[1], kPos1, kPos2)); // Uncomment the following to at the VOILine to the image: //VOILine kLine = new VOILine(); //kLine.add(kPos1); //kLine.add(kPos2); //VOI kVOI = new VOI( (short)srcImage.getVOIs().size(), "LargestDist", VOI.LINE, 0 ); //kVOI.importCurve(kLine); //srcImage.registerVOI(kVOI); } } statProperty.setProperty(VOIStatisticList.largestSliceDistanceDescription, nf.format(stats.largestContourDistance)); } if ( statsList[ indexOf( largestDistanceDescription ) ] ) { stats.largestContourDistance = largestDistance; statProperty.setProperty(VOIStatisticList.largestDistanceDescription, nf.format(stats.largestContourDistance)); } // Ellipsoid fit parameters are calculated as a group, if one is selected, calculate all. // For the VOI, only calculate these parameters for one contour: if ( statsList[ indexOf( axisDescription ) ] || statsList[ indexOf( eccentricityDescription ) ] || statsList[ indexOf( majorAxisDescription ) ] || statsList[ indexOf( minorAxisDescription ) ] ) { float[] tmpPAxis = new float[1]; float[] tmpEcc = new float[1]; float[] tmpMajorAxis = new float[1]; float[] tmpMinorAxis = new float[1]; ((VOIContour)contours.firstElement()).secondOrderAttributes(srcImage, tmpPAxis, tmpEcc, tmpMajorAxis, tmpMinorAxis); stats.PAxis = tmpPAxis[0]; stats.Ecc = tmpEcc[0]; stats.MajorAxis = tmpMajorAxis[0]; stats.MinorAxis = tmpMinorAxis[0]; System.out.println("HERE2"); statProperty.setProperty(VOIStatisticList.axisDescription, nf.format(stats.PAxis)); statProperty.setProperty(VOIStatisticList.eccentricityDescription, nf.format(stats.Ecc)); statProperty.setProperty(VOIStatisticList.majorAxisDescription, nf.format(stats.MajorAxis)); statProperty.setProperty(VOIStatisticList.minorAxisDescription, nf.format(stats.MinorAxis)); } }
-
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 statisticsstatProperty
- output is written to the statPropertyunit2DStr
- 2D label stringunit3DStr
- 3D label stringend
- tag for statProperty labelsignoreMin
- threshold minimumignoreMax
- threshold maximumlargestDistance
- 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 statisticsstatProperty
- output is written to the statPropertyunit2DStr
- 2D label stringunit3DStr
- 3D label stringend
- tag for statProperty labelsignoreMinR
- threshold minimum redignoreMaxR
- threshold maximum redignoreMinG
- threshold minimum greenignoreMaxG
- threshold maximum greenignoreMinB
- threshold minimum blueignoreMaxB
- threshold maximum bluelargestDistance
- 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 statisticsstatProperty
- output is written to the statPropertyunit2DStr
- 2D label stringunit3DStr
- 3D label stringend
- tag for statProperty labelsignoreMin
- threshold minimumignoreMax
- threshold maximumlargestDistance
- 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 statisticsstatProperty
- output is written to the statPropertyunit2DStr
- 2D label stringunit3DStr
- 3D label stringend
- tag for statProperty labelsignoreMinR
- threshold minimum redignoreMaxR
- threshold maximum redignoreMinG
- threshold minimum greenignoreMaxG
- threshold maximum greenignoreMinB
- threshold minimum blueignoreMaxB
- threshold maximum bluelargestDistance
- VOI largest distance.
-
-