/** * Creates a new JDialogNonlocalMeansFilter object. * * @param theParentFrame Parent frame. * @param im Source image. */ public JDialogNonlocalMeansFilter(Frame theParentFrame, ModelImage im) { super(theParentFrame, false); image = im; userInterface = ViewUserInterface.getReference(); init(); setVisible(true); }
/** {@inheritDoc} */ protected void setGUIFromParams() { image = scriptParameters.retrieveInputImage(); userInterface = ViewUserInterface.getReference(); parentFrame = image.getParentFrame(); if (scriptParameters.doOutputNewImage()) { setDisplayLocNew(); } else { setDisplayLocReplace(); } searchWindowSide = scriptParameters.getParams().getInt("search_window_side"); similarityWindowSide = scriptParameters.getParams().getInt("similarity_window_side"); noiseStandardDeviation = scriptParameters.getParams().getFloat("noise_standard_deviation"); degreeOfFiltering = scriptParameters.getParams().getFloat("degree_of_filtering"); doRician = scriptParameters.getParams().getBoolean("do_rician"); image25D = scriptParameters.doProcess3DAs25D(); }
/** {@inheritDoc} */ protected void setGUIFromParams() { image = scriptParameters.retrieveInputImage(1); userInterface = ViewUserInterface.getReference(); parentFrame = image.getParentFrame(); if (scriptParameters.doOutputNewImage()) { setDisplayLocNew(); } else { // replace processing not supported.. // setDisplayLocReplace(); setDisplayLocNew(); } subXDim = scriptParameters.getParams().getInt("sub_x_dim"); subYDim = scriptParameters.getParams().getInt("sub_y_dim"); numberOfImagesInMosaic = scriptParameters.getParams().getInt("number_of_images_in_mosaic"); }
/** Starts the program. */ public void runAlgorithm() { int i, j, k; if (srcImage == null) { displayError("Source Image is null"); finalize(); return; } if (threadStopped) { finalize(); return; } trueVOIs = srcImage.getVOIs(); nTrueVOIs = trueVOIs.size(); testVOIs = testImage.getVOIs(); nTestVOIs = testVOIs.size(); length = srcImage.getExtents()[0]; for (i = 1; i < srcImage.getNDims(); i++) { length *= srcImage.getExtents()[i]; } testLength = testImage.getExtents()[0]; for (i = 1; i < testImage.getNDims(); i++) { testLength *= testImage.getExtents()[i]; } if (length != testLength) { MipavUtil.displayError( srcImage.getImageName() + " and " + testImage.getImageName() + " are unequal in dimensions"); setCompleted(false); return; } trueMask = new short[length]; testMask = new short[length]; ViewUserInterface.getReference().setGlobalDataText(srcImage.getImageName() + " = true\n"); ViewUserInterface.getReference().setGlobalDataText(testImage.getImageName() + " = test\n"); for (i = 0; i < nTrueVOIs; i++) { if ((trueVOIs.VOIAt(i).getCurveType() == VOI.CONTOUR) || (trueVOIs.VOIAt(i).getCurveType() == VOI.POLYLINE)) { trueID = trueVOIs.VOIAt(i).getID(); for (j = 0; j < nTestVOIs; j++) { testID = testVOIs.VOIAt(j).getID(); if (trueID == testID) { for (k = 0; k < length; k++) { trueMask[k] = -1; testMask[k] = -1; } trueMask = srcImage.generateVOIMask(trueMask, i); testMask = testImage.generateVOIMask(testMask, j); absoluteTrue = 0; trueFound = 0; falseNegative = 0; falsePositive = 0; for (k = 0; k < length; k++) { if (trueMask[k] == trueID) { absoluteTrue++; if (testMask[k] == trueID) { trueFound++; } else { falseNegative++; } } // if (trueMask[k] == trueID) else { // trueMask[k] != trueID if (testMask[k] == trueID) { falsePositive++; } } // else trueMask[k] != trueID } // for (k = 0; k < length; k++) ViewUserInterface.getReference() .setGlobalDataText( "Statistics for VOIs with ID = " + String.valueOf(trueID) + "\n"); fnvf = (float) falseNegative / (float) absoluteTrue; ViewUserInterface.getReference() .setGlobalDataText( " False negative volume fraction = " + String.valueOf(fnvf) + "\n"); fpvf = (float) falsePositive / (float) absoluteTrue; ViewUserInterface.getReference() .setGlobalDataText( " False positive volume fraction = " + String.valueOf(fpvf) + "\n"); tpvf = (float) trueFound / (float) absoluteTrue; ViewUserInterface.getReference() .setGlobalDataText( " True Positive volume fraction = " + String.valueOf(tpvf) + "\n\n"); } // if (trueID == testID) } // for (j = 0; j < nTestVOIs; j++) } // if ((trueVOIs.VOIAt(i).getCurveType() == VOI.CONTOUR) } // for (i = 0; i < nTrueVOIs; i++) setCompleted(true); }
/** * Creates new Mosaic To Slices dialog. * * @param theParentFrame Parent frame. * @param im Source image. */ public JDialogMosaicToSlices(Frame theParentFrame, ModelImage im) { super(theParentFrame, false); image = im; userInterface = ViewUserInterface.getReference(); init(); }