Class JDialogScriptableBase

All Implemented Interfaces:
ScriptableActionInterface, DialogDefaultsInterface, ActionListener, FocusListener, ItemListener, WindowListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants
Direct Known Subclasses:
JDialog3DMosaicTo4DSlices, JDialog4DImageCalculator, JDialogActiveContoursWithoutEdges, JDialogAdaptiveKuwaharaFilter, JDialogAddMargins, JDialogAGCIE, JDialogAHE, JDialogAHElocal, JDialogAINDANE, JDialogAnisotropicDiffusion, JDialogAnonymizeImage, JDialogAntigradient2, JDialogAutoCorrelation, JDialogAutoCovariance, JDialogAutoSeedWatershed, JDialogBarrelDistortion, JDialogBGAndFGDistanceMap, JDialogBGDistanceMap, JDialogBilateralFilter, JDialogBiorthogonalWavelets, JDialogBM3D, JDialogBorderClearing, JDialogBottomHat, JDialogBoundaryAttenuation, JDialogBoxCount, JDialogBrainSurfaceExtractor, JDialogBRISK, JDialogBulkImageCalculator, JDialogCannyEdgeDetection, JDialogCenterOfMass, JDialogCenterOfMassRGB, JDialogClose, JDialogCoherenceEnhancingDiffusion, JDialogColocalizationEM, JDialogColocalizationRegression, JDialogColorEdge, JDialogColorSaturation, JDialogConcat, JDialogConcatMult2Dto3D, JDialogConcatMult3Dto3D, JDialogConcatMult3Dto4D, JDialogConstrainedOAR3D, JDialogContrastEnhancementUsingExposureFusion, JDialogConvergenceField, JDialogConvert3Dto4D, JDialogConvert4Dto3D, JDialogConvert4DtoMultiple3D, JDialogConvert4DtoRGB, JDialogConvertType, JDialogCorrectSpacing, JDialogCrop, JDialogCropBoundaryParam, JDialogCropPointParam, JDialogCropTiltedCuboid, JDialogCropTiltedRectangle, JDialogCyclicPermutation, JDialogDBSCANClusteringSegment, JDialogDeconvolution, JDialogDeleteObjects, JDialogDemonsLite, JDialogDEMRI3, JDialogDicomTagSelector, JDialogDilate, JDialogDirectResample, JDialogDiscreteCosineTransform, JDialogDiscreteSineTransform, JDialogDistanceMap, JDialogDSC_MRI_toolbox, JDialogEdgeDetection3D, JDialogEdgeLaplacian, JDialogEdgeNMSuppression, JDialogEdgePreservingSmoothing, JDialogEditCircleDiameter, JDialogEditSquareLength, JDialogEfficientWatershed, JDialogEmbeddedConfidenceEdgeDetection, JDialogEntropicEdgeDetection, JDialogEntropyMinimization, JDialogErode, JDialogEvaluateMaskSegmentation, JDialogEvaluateSegmentation, JDialogExtractBrain, JDialogExtractSlices, JDialogExtractSlicesVolumes, JDialogExtractSurfaceCubes, JDialogFaceAnonymize, JDialogFaceAnonymizerBET, JDialogFacetModel, JDialogFastMarching, JDialogFFT, JDialogFileInfoDICOM, JDialogFillObjects, JDialogFindEdges, JDialogFIREEdgeExtraction, JDialogFlip, JDialogFrequencyFilter, JDialogFRETBleedThrough, JDialogFRETEfficiency, JDialogFuzzMinDeAndChatterji, JDialogFuzzyCMeans, JDialogFuzzyConnectednessSegmentation, JDialogFuzzyMinimization, JDialogGaborFilter, JDialogGaussianBlur, JDialogGenerateGrid, JDialogGenerateIsolines, JDialogGradientInverseWeightedSmoothing, JDialogGradientMagnitude, JDialogGraphBasedSegmentation, JDialogGuidedFilter, JDialogHaarTransform, JDialogHaralickTexture, JDialogHarrisCornerDetector, JDialogHarrisLaplace, JDialogHartleyTransform, JDialogHillClimbingWatershed, JDialogHistogram2Dim, JDialogHistogramMatch, JDialogHistogramSliceMatch, JDialogHistogramSummary, JDialogHMRF_EM, JDialogHomomorphicFilter, JDialogHurstIndex, JDialogIAGCWD, JDialogIDObjects, JDialogIHN3Correction, JDialogImageCalculator, JDialogImageMath, JDialogImRegPOC, JDialogIndependentComponents, JDialogInsertMissingSlices, JDialogInsertSlice, JDialogInsertVolume, JDialogInvert, JDialogIsophoteCurvature, JDialogKernelRegression, JDialogKMeans, JDialogLaplacian, JDialogLargestCircle, JDialogLawsTexture, JDialogLightboxGen, JDialogLLE, JDialogLoadImage, JDialogLocalNormalization, JDialogLocalVariance, JDialogLogSlopeMapping, JDialogLowerCompletion, JDialogLuminanceAdaptation, JDialogMarkovSegment, JDialogMarkovSmooth, JDialogMask, JDialogMatchImages, JDialogMaximumIntensityProjection, JDialogMaximumLikelihoodIteratedBlindDeconvolution, JDialogMean, JDialogMeanShiftClustering, JDialogMeanShiftSegmentation, JDialogMedian, JDialogMidsagittal, JDialogMode, JDialogMorphologicalFilter, JDialogMorphologicalGradient, JDialogMorphologicalLaplacian, JDialogMorphologicalReconstruction, JDialogMosaicToSlices, JDialogMotionDetection, JDialogMRIShadingCorrection, JDialogMSER, JDialogMSFuzzyCMeans, JDialogMultiResolutionBilateralFilter, JDialogMultiResolutionGuidedFilter, JDialogMultiScaleHornSchunk, JDialogN4MRIBiasFieldCorrection, JDialogNLMeans_filt2D, JDialogNLNoiseReduction, JDialogNMSuppression, JDialogNoise, JDialogNoiseLevel, JDialogNonlocalMeansFilter, JDialogOpen, JDialogPadImages, JDialogParticleAnalysisNew, JDialogPbBoundaryDetection, JDialogPhasePreservingDenoising, JDialogPointArea, JDialogPowerWatershed, JDialogPrincipalComponents, JDialogProstateBoundaryFeatureTrain, JDialogProstateFeaturesClassification, JDialogProstateFeaturesTrain, JDialogProstateSaveFeatures, JDialogPyWavelets, JDialogQuantify, JDialogQuantifyMask, JDialogRandomizeSliceOrder, JDialogRegionMergingViaBoundaryMelting, JDialogRegionsFromPartialBorders, JDialogRegistrationBSpline, JDialogRegistrationLeastSquares, JDialogRegistrationOAR25D, JDialogRegistrationOAR2D, JDialogRegistrationOAR35D, JDialogRegistrationOAR3D, JDialogRegistrationSIFT3D, JDialogRegistrationTPSpline, JDialogRegPatientPos, JDialogRegularizedIsotropicDiffusion, JDialogRemoveSlices, JDialogRemoveTSlices, JDialogReorient, JDialogReplaceBlankSlicesWithAverages, JDialogReplaceValue, JDialogReslice, JDialogRGBConcat, JDialogRGBtoGray, JDialogRGBtoGrays, JDialogRGBtoHSB, JDialogRotate, JDialogRuleBasedContrastEnhancement, JDialogScaleSaliency, JDialogSCDSegmentation, JDialogScriptableTransform, JDialogSequentialScanningWatershed, JDialogShortestPathWatershed, JDialogShowCosts, JDialogSIFT, JDialogSIFTImageSimilarity, JDialogSimulatedExposureFusion, JDialogSingleScaleHornSchunk, JDialogSkeletonize, JDialogSlantTransform, JDialogSliceAveraging, JDialogSM2, JDialogSobel, JDialogSpatialBroxOpticalFlow, JDialogSpectralClustering, JDialogSplitAndMergeWatershed, JDialogStandaloneScriptablePlugin, JDialogStandardDeviationThreshold, JDialogSubsample, JDialogSubset, JDialogSubtractVOI, JDialogSwap34, JDialogSwapDims, JDialogSwapSlicesVolumes, JDialogSWI, JDialogSymmetricNearestNeighbor, JDialogTamuraTexture, JDialogTemporalBroxOpticalFlow, JDialogTextureAnalysis, JDialogTextureSegmentation, JDialogThinning2D, JDialogThreshold, JDialogThresholdRGB, JDialogTiltCorrection, JDialogTimeFitting, JDialogTopHat, JDialogTransformBSpline, JDialogTreMethod, JDialogTreT2, JDialogTrilateralFilter, JDialogTVL1FLOW, JDialogUltErode, JDialogUnionFindComponentLabelling, JDialogUnionFindWatershed, JDialogUnsharpMask, JDialogVesselEnhancement, JDialogVOIHausdorffDistance, JDialogVOILogicalOperations, JDialogVOIStatistics, JDialogVOIStats, JDialogWalshHadamardTransform, JDialogWatershed, JDialogWaveletFuse, JDialogWaveletMultiscaleProducts, JDialogWaveletThreshold

public abstract class JDialogScriptableBase extends JDialogBase implements ScriptableActionInterface
All scriptable dialogs should inherit from this abstract class. It contains helper methods which make script running/recording easier.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Use serialVersionUID for interoperability.
      See Also:
    • scriptParameters

      protected AlgorithmParameters scriptParameters
      Contains parameters used to run or record the dialog action, along with some common helper methods.
    • displayInNewFrame

      protected boolean displayInNewFrame
    • isComplete

      protected boolean isComplete
      Indicates whether the scripted algorithm completed successfully. Used to retain the status after the dialog has finalized the algorithm handle(s) in algorithmPerformed.
  • Constructor Details

    • JDialogScriptableBase

      public JDialogScriptableBase()
      Passthrough to JDialogBase constructor.
      See Also:
    • JDialogScriptableBase

      public JDialogScriptableBase(boolean modal)
      Passthrough to JDialogBase constructor.
      Parameters:
      modal - Whether the dialog is modal.
      See Also:
    • JDialogScriptableBase

      public JDialogScriptableBase(Frame parent, boolean modal)
      Passthrough to JDialogBase constructor.
      Parameters:
      parent - The parent frame.
      modal - Whether the dialog is modal.
      See Also:
    • JDialogScriptableBase

      public JDialogScriptableBase(Dialog parent, boolean modal)
      Passthrough to JDialogBase constructor.
      Parameters:
      parent - The parent dialog.
      modal - Whether this dialog is modal.
      See Also:
    • JDialogScriptableBase

      public JDialogScriptableBase(Dialog parent, boolean modal, boolean menuVisible)
      Passthrough to JDialogBase constructor.
      Parameters:
      parent - The parent dialog.
      modal - Whether this dialog is modal.
      menuVisible - whether the preference loading menu should be displayed
      See Also:
  • Method Details

    • getDialogActionString

      public static final String getDialogActionString(Class<? extends JDialogScriptableBase> dialogClass)
      Extracts the scripting action string which should be used for a given class.
      Parameters:
      dialogClass - The class to get the script action string for (should be prefixed with JDialog).
      Returns:
      The script action string (e.g., 'GaussianBlur' for 'gov.nih.mipav.view.dialogs.JDialogGaussianBlur').
    • insertScriptLine

      public void insertScriptLine()
      If a script is being recorded and the action (read: algorithm) is done, add an entry for this action.
      Specified by:
      insertScriptLine in interface ScriptableActionInterface
    • scriptRun

      public void scriptRun(ParameterTable parameters) throws IllegalArgumentException
      Sets up the action dialog state and then executes it.
      Specified by:
      scriptRun in interface ScriptableActionInterface
      Parameters:
      parameters - Table of parameters for the script to use.
      Throws:
      IllegalArgumentException - If there is a problem with the action arguments.
    • callAlgorithm

      protected abstract void callAlgorithm()
      Starts the algorithm. Already exists in most algorithm dialogs. Should be called during scripted execution and regular operation.
    • setGUIFromParams

      protected abstract void setGUIFromParams()
      Set the dialog GUI using the script parameters while running this algorithm as part of a script.
    • storeParamsFromGUI

      protected abstract void storeParamsFromGUI() throws ParserException
      Record the parameters just used to run this algorithm in a script.
      Throws:
      ParserException - If there is a problem creating/recording the new parameters.
    • doPostAlgorithmActions

      protected void doPostAlgorithmActions()
      Used to perform actions after the execution of the algorithm is completed (e.g., put the result image in the image table). Defaults to no action, override to actually have it do something.
    • setComplete

      protected void setComplete(boolean success)
      Sets the flag to indicate whether the algorithm completed successfully. Used to retain the status after the dialog has finalized the algorithm handle(s) in algorithmPerformed.
      Parameters:
      success - True if the algorithm has finished successfully, false if it is not done yet or there was a problem.
    • isComplete

      protected boolean isComplete()
      Returns whether the algorithm completed successfully. Used to retain the status after the dialog has finalized the algorithm handle(s) in algorithmPerformed.
      Returns:
      True if the algorithm has finished successfully, false if it is not done yet or there was a problem.