Class AlgorithmBase

    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean completed
      This flag will be set to true when the algorithm has completed.
      protected boolean destFlag
      Destination flag indicating if a destination (result) image is generated.
      protected ModelImage destImage
      Destination image.
      private double elapsedTime
      Elapsed time (in milliseconds) -- time it took for algorithm to run.
      protected boolean image25D
      If true process each image of a 3D volume independently.
      private javax.swing.event.EventListenerList listenerList
      A list of the ChangeListeners which are interested in the ChangeEvent.
      protected java.util.BitSet mask
      Mask indicating which voxels to process.
      protected int maxProgressValue
      Used to store the maximum value of the progress bar.
      protected int minProgressValue
      Used to store the minimum value of the progress bar.
      protected boolean multiThreadingEnabled
      Indicates if multi-threading will be used to optimize the algorithm.
      protected int nthreads
      The number of threads will be used to execute the algorithm if multi-threading is enabled
      private java.util.Vector<AlgorithmInterface> objectList
      Vector list of AlgorithmInterface objects.
      protected float progress
      Store the progress being made.
      protected int progressModulus  
      protected float progressStep  
      protected boolean runningInSeparateThread
      Should be set to true if NOT in a single thread - will NOT force a graphics update of the progress bar.
      protected boolean separable
      If true convolution kernels are separable.
      protected ModelImage srcImage
      Source image.
      private long startTime
      Start time (in milliseconds) to be used to compute elapsed time.
      protected boolean threadStopped
      Flag indicating whether or not the thread is stopped.
      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Constructor Summary

      Constructors 
      Constructor Description
      AlgorithmBase()
      Default constructor which sets thread stopped to false, source and destination images to null, and destination flag to false.
      AlgorithmBase​(ModelImage destImage, ModelImage srcImage)
      Constructor which sets thread stopped to false and sets source and destination images.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent e)
      Routine to catch action events
      void addListener​(AlgorithmInterface obj)
      Add a listener to this class so that when when the algorithm has completed processing it can use notifyListener to notify all listeners that the algorithm has completed.
      void addProgressChangeListener​(ProgressChangeListener l)
      Adds the ProgressChangeListener to this FileBase object.
      static int calculateImageSize​(int[] dims)
      Calculate the size of the image.
      void calculatePrincipleAxis​(ModelImage image, boolean doColor)
      Working ...
      double computeElapsedTime()
      Computes the elapased time as the difference between the start time and the current time (both of which are in milliseconds).
      static double computeElapsedTime​(long start)
      Computes the elapased time as the difference between the start time and the current time (both of which are in milliseconds).
      protected float[] convertIntoFloat​(java.lang.String[] str)
      Takes an array of strings and converts each entry into a float value.
      protected void delinkProgressToAlgorithm​(AlgorithmBase baseAlgo)
      Disconnect this algorithm with the progress bar which holds a reference to this algorithm.
      protected void delinkProgressToAlgorithmMulti​(AlgorithmBase baseAlgo)  
      void displayError​(java.lang.String error)
      Displays an error in a frame.
      void errorCleanUp​(java.lang.String strErr, boolean gcFlag)
      Display string pass into the method.
      void finalize()
      Calls garbage collector to release system resources.
      protected void fireProgressStateChanged​(float fVal, java.lang.String title, java.lang.String message)
      Updates listeners of progress status.
      protected void fireProgressStateChanged​(int value)
      Notifies all listeners that have registered interest for notification on this event type.
      protected void fireProgressStateChanged​(int value, java.lang.String title, java.lang.String message)
      Notifies all listeners that have registered interest for notification on this event type.
      protected void fireProgressStateChanged​(java.lang.String message)
      Notifies listeners that have registered interest for notification on this event type.
      protected void fireProgressStateChanged​(java.lang.String imageName, java.lang.String message)
      Updates listeners of progress status.
      int[] generateProgressValues​(int currentProgress, int desiredMaxProgress)
      Helper function to determine which values to pass on to linked algorithms (that will fire progress changes to the same progress bar).
      ModelImage getDestImage()
      Accessor to return the destination image
      double getElapsedTime()
      Returns the elapsed time in seconds.
      java.util.BitSet getMask()
      Gets the Bitset mask object.
      int getMaxProgressValue()
      Returns the max progress value.
      int getMinProgressValue()
      Returns the min progress value.
      int getNumberOfThreads()  
      float getProgress()  
      ViewJProgressBar getProgressChangeListener()
      If there is a progress bar that is listening to the algorithm's progress change events, this will retrieve that progress bar.
      ProgressChangeListener[] getProgressChangeListeners()
      Returns the progress change event listener list.
      int getProgressModulus()  
      float getProgressStep()  
      int[] getProgressValues()
      Gets the current stored min and max progress values.
      ModelImage getSrcImage()
      Gets the current source image for the algorithm
      boolean isCompleted()
      Returns flag that indicates that the algorithm has been sucessfully completed.
      boolean isImage25D()
      Returns flag that indicates if the image should be processed slice by slice.
      boolean isMultiThreadingEnabled()  
      boolean isRunningInSeparateThread()
      Should be set to true if NOT in a single thread (i.e., the main gui and this algo are in different threads) - will NOT force a graphics update of the progress bar.
      boolean isThreadStopped()
      Returns flag that indicates that the algorithm thread has been stopped.
      protected void linkProgressToAlgorithm​(AlgorithmBase baseAlgo)
      Helper function to link the currently listening progress bar with an algorithm created within an algorithm.
      protected void linkProgressToAlgorithm​(AlgorithmBase baseAlgo, java.lang.String title, int min, int max)
      New helper function for use with the ViewJProgressBarMulti.
      void makeProgress​(float step)  
      void notifyListeners​(AlgorithmBase algorithm)
      Used to notify all listeners that the algorithm has completed.
      void removeListener​(AlgorithmInterface obj)
      Remove a listener from the class.
      void removeProgressChangeListener​(ProgressChangeListener l)
      Removes the ChangeListener from the FileBase object.
      void run()
      Performs start-up and tear-down operations that should be done by all algorithms (timing, history log).
      abstract void runAlgorithm()
      Actually runs the algorithm.
      void setCompleted​(boolean flag)
      Sets completed to flag indicating if algorithm has sucessfully completed.
      void setImage25D​(boolean flag)
      Sets a flag to indicate the image has dimensions of (i.e. spacial, spacial, time) and image processing routines should apply 2.5D algorithm.
      void setMask​(java.util.BitSet imageMask)
      Sets the mask (BitSet object).
      void setMaxProgressValue​(int maxProgressValue)
      Sets the max progress value.
      void setMinProgressValue​(int minProgressValue)
      Sets the min progress value.
      void setMultiThreadingEnabled​(boolean multiThreadingEnabled)  
      void setNumberOfThreads​(int nthreads)  
      void setProgress​(int progress)  
      void setProgressModulus​(int progressModulus)  
      void setProgressStep​(float progressStep)  
      void setProgressValues​(int[] minmax)
      Sets the min and max progress values from an array of two ints.
      void setProgressValues​(int min, int max)
      Sets both the min and max progress values.
      void setRunningInSeparateThread​(boolean separateThread)
      Sets the running in separate thread flag which controls how the progress bar is updated.
      void setSrcImage​(ModelImage srcImage)
      Sets the source image of the algorithm
      void setStartTime()
      Sets the start time to the current time.
      void setThreadStopped​(boolean flag)
      Sets the thread stopped to flag indicating if algorithm has stopped.
      boolean startMethod​(int priority)
      Checks to see if a thread is already running on this object.
      void windowActivated​(java.awt.event.WindowEvent event)
      Do nothing.
      void windowClosed​(java.awt.event.WindowEvent event)
      Do nothing.
      void windowClosing​(java.awt.event.WindowEvent event)
      Sets completed to false, disposes the progress bar and notifies all listeners that the algorithm is stopped.
      void windowDeactivated​(java.awt.event.WindowEvent event)
      Do nothing.
      void windowDeiconified​(java.awt.event.WindowEvent event)
      Do nothing.
      void windowIconified​(java.awt.event.WindowEvent event)
      Do nothing.
      void windowOpened​(java.awt.event.WindowEvent event)
      Do nothing.
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • destFlag

        protected boolean destFlag
        Destination flag indicating if a destination (result) image is generated.
      • destImage

        protected ModelImage destImage
        Destination image.
      • image25D

        protected boolean image25D
        If true process each image of a 3D volume independently.
      • separable

        protected boolean separable
        If true convolution kernels are separable.
      • mask

        protected java.util.BitSet mask
        Mask indicating which voxels to process. If true process voxel else skip.
      • runningInSeparateThread

        protected boolean runningInSeparateThread
        Should be set to true if NOT in a single thread - will NOT force a graphics update of the progress bar. Should be set to false if in a single thread - will force a graphics update of the progress bar. This defaults to false, since we can automatically set it to true when startMethod() is called. When starting the algorithm with run(), this boolean should remain false.
        See Also:
        startMethod(int), run()
      • srcImage

        protected ModelImage srcImage
        Source image.
      • threadStopped

        protected volatile boolean threadStopped
        Flag indicating whether or not the thread is stopped.
      • completed

        private boolean completed
        This flag will be set to true when the algorithm has completed.
      • elapsedTime

        private double elapsedTime
        Elapsed time (in milliseconds) -- time it took for algorithm to run.
      • listenerList

        private javax.swing.event.EventListenerList listenerList
        A list of the ChangeListeners which are interested in the ChangeEvent.
      • maxProgressValue

        protected int maxProgressValue
        Used to store the maximum value of the progress bar.
      • minProgressValue

        protected int minProgressValue
        Used to store the minimum value of the progress bar.
      • objectList

        private java.util.Vector<AlgorithmInterface> objectList
        Vector list of AlgorithmInterface objects. When the algorithm has been stopped or completed, all listeners in this list are notified.
      • startTime

        private long startTime
        Start time (in milliseconds) to be used to compute elapsed time.
      • progress

        protected float progress
        Store the progress being made.
      • progressStep

        protected float progressStep
      • progressModulus

        protected int progressModulus
      • multiThreadingEnabled

        protected boolean multiThreadingEnabled
        Indicates if multi-threading will be used to optimize the algorithm.
      • nthreads

        protected int nthreads
        The number of threads will be used to execute the algorithm if multi-threading is enabled
    • Constructor Detail

      • AlgorithmBase

        public AlgorithmBase()
        Default constructor which sets thread stopped to false, source and destination images to null, and destination flag to false.
      • AlgorithmBase

        public AlgorithmBase​(ModelImage destImage,
                             ModelImage srcImage)
        Constructor which sets thread stopped to false and sets source and destination images.
        Parameters:
        destImage - Destination image, can be null.
        srcImage - Source image, should not be null.
    • Method Detail

      • runAlgorithm

        public abstract void runAlgorithm()
        Actually runs the algorithm. Implemented by inheriting algorithms.
      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent e)
        Routine to catch action events
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        Parameters:
        e - ActionEvent
      • addListener

        public void addListener​(AlgorithmInterface obj)
        Add a listener to this class so that when when the algorithm has completed processing it can use notifyListener to notify all listeners that the algorithm has completed.
        Parameters:
        obj - AlgorithmInterface "object' to be added to the list
      • addProgressChangeListener

        public void addProgressChangeListener​(ProgressChangeListener l)
        Adds the ProgressChangeListener to this FileBase object.
        Parameters:
        l - the ProgressChangeListener object
      • calculatePrincipleAxis

        public void calculatePrincipleAxis​(ModelImage image,
                                           boolean doColor)
        Working ... This function is never used. It doesn't modify any parameters or data members and returns void.
        Parameters:
        image - DOCUMENT ME!
        doColor - DOCUMENT ME!
      • computeElapsedTime

        public double computeElapsedTime()
        Computes the elapased time as the difference between the start time and the current time (both of which are in milliseconds).
        Returns:
        the elapsed time in seconds -- this is a double value
      • computeElapsedTime

        public static double computeElapsedTime​(long start)
        Computes the elapased time as the difference between the start time and the current time (both of which are in milliseconds).
        Returns:
        the elapsed time in seconds -- this is a double value
      • displayError

        public void displayError​(java.lang.String error)
        Displays an error in a frame.
        Parameters:
        error - string that is displayed
      • errorCleanUp

        public void errorCleanUp​(java.lang.String strErr,
                                 boolean gcFlag)
        Display string pass into the method. If the string is null no message is displayed. The completed flag is set to false and the progress bar is disposed;
        Parameters:
        strErr - the string that is to be displayed. If the string is null no message is displayed.
        gcFlag - if true call the garbage collector.
      • finalize

        public void finalize()
        Calls garbage collector to release system resources.
        Overrides:
        finalize in class java.lang.Object
      • generateProgressValues

        public int[] generateProgressValues​(int currentProgress,
                                            int desiredMaxProgress)
        Helper function to determine which values to pass on to linked algorithms (that will fire progress changes to the same progress bar). You pass in the current progress and then the max desired progress.... you do NOT adjust the progress yourself, you assume a 0-100 range always, so if the current progress of a certain algorithm was 50%, and you want the helper algorithm to run on an adjusted scale of 50% to 70%, then you pass 50 and 70 as current & desiredMax respectively. if the algorithm passing this in was on a scale of 0->50, then the displayed progress will range from 25% to 35% (50% of 50->70)
        Parameters:
        currentProgress - current progress of algorithm on a 0->100 scale
        desiredMaxProgress - max progress desired for linked algorithm
        Returns:
        array of 2 ints [current, max]
      • getDestImage

        public ModelImage getDestImage()
        Accessor to return the destination image
        Returns:
        ModelImage destination image
      • getElapsedTime

        public double getElapsedTime()
        Returns the elapsed time in seconds. This does not compute a new elapsed time.
        Returns:
        the elapsed time, in seconds computed earlier
        See Also:
        computeElapsedTime()
      • getMask

        public java.util.BitSet getMask()
        Gets the Bitset mask object.
        Returns:
        The mask indicating which voxels of the image to process
      • getMaxProgressValue

        public int getMaxProgressValue()
        Returns the max progress value.
        Returns:
        max progress value
      • getMinProgressValue

        public int getMinProgressValue()
        Returns the min progress value.
        Returns:
        min progress value
      • getProgressChangeListener

        public ViewJProgressBar getProgressChangeListener()
        If there is a progress bar that is listening to the algorithm's progress change events, this will retrieve that progress bar. This function is really only here to support AlgorithmExtractSurface, AlgorithmExtractSurfaceCubes, and AlgorithmHeightFunction which use ModelQuadMesh and ModelTriangle Mesh (which do not follow the standard algorithmbase setup). This function should not be used elsewhere and will probably be removed (and modelquad/trianglemesh will be changed).
        Returns:
        a progressbar if there is one listening, null otherwise.
      • getProgressChangeListeners

        public ProgressChangeListener[] getProgressChangeListeners()
        Returns the progress change event listener list.
        Returns:
        the progress change event listener list.
      • getProgressValues

        public int[] getProgressValues()
        Gets the current stored min and max progress values.
        Returns:
        int [] { currentMin, currentMax}
      • getSrcImage

        public ModelImage getSrcImage()
        Gets the current source image for the algorithm
        Returns:
        the source image
      • isCompleted

        public boolean isCompleted()
        Returns flag that indicates that the algorithm has been sucessfully completed.
        Returns:
        true if algorithm completed successfully, false if it was stopped or had an error.
      • isImage25D

        public boolean isImage25D()
        Returns flag that indicates if the image should be processed slice by slice.
        Returns:
        true if image should be processed slice by slice.
      • isRunningInSeparateThread

        public boolean isRunningInSeparateThread()
        Should be set to true if NOT in a single thread (i.e., the main gui and this algo are in different threads) - will NOT force a graphics update of the progress bar. Should be set to false if in a single thread - will force a graphics update of the progress bar.
        Returns:
        boolean true if this algorithm is in a different thread from the main mipav gui thread.
      • isThreadStopped

        public boolean isThreadStopped()
        Returns flag that indicates that the algorithm thread has been stopped.
        Returns:
        true if thread has stopped.
      • notifyListeners

        public void notifyListeners​(AlgorithmBase algorithm)
        Used to notify all listeners that the algorithm has completed.
        Parameters:
        algorithm - algorithm class that has completed the function
      • removeListener

        public void removeListener​(AlgorithmInterface obj)
        Remove a listener from the class.
        Parameters:
        obj - the algorithm listener to be removed from the list for this algo
      • removeProgressChangeListener

        public void removeProgressChangeListener​(ProgressChangeListener l)
        Removes the ChangeListener from the FileBase object.
        Parameters:
        l - the ProgressChangeListener object
      • run

        public void run()
        Performs start-up and tear-down operations that should be done by all algorithms (timing, history log). Since this class extends the Thread class it can be run in its own thread by invoking object.start(); It can also be invoked without a new thread by calling the the run() method directly (ie. object.run()).
        Specified by:
        run in interface java.lang.Runnable
        Overrides:
        run in class java.lang.Thread
      • setCompleted

        public void setCompleted​(boolean flag)
        Sets completed to flag indicating if algorithm has sucessfully completed.
        Parameters:
        flag - Flag to set to true if the algorithm has completed.
      • setImage25D

        public void setImage25D​(boolean flag)
        Sets a flag to indicate the image has dimensions of (i.e. spacial, spacial, time) and image processing routines should apply 2.5D algorithm.
        Parameters:
        flag - flag to set to
      • setMask

        public void setMask​(java.util.BitSet imageMask)
        Sets the mask (BitSet object).
        Parameters:
        imageMask - BitSet object indicating which voxels to process
      • setMaxProgressValue

        public void setMaxProgressValue​(int maxProgressValue)
        Sets the max progress value.
        Parameters:
        maxProgressValue - the maximum progress value
      • setMinProgressValue

        public void setMinProgressValue​(int minProgressValue)
        Sets the min progress value.
        Parameters:
        minProgressValue - the minimum progress value
      • setProgressValues

        public void setProgressValues​(int[] minmax)
        Sets the min and max progress values from an array of two ints.
        Parameters:
        minmax - array of two ints [min, max]
      • setProgressValues

        public void setProgressValues​(int min,
                                      int max)
        Sets both the min and max progress values.
        Parameters:
        min - the min progress value
        max - the max progress value
      • setRunningInSeparateThread

        public void setRunningInSeparateThread​(boolean separateThread)
        Sets the running in separate thread flag which controls how the progress bar is updated. If true the progress bar is not forced to update.
        Parameters:
        separateThread - Should be set to true if NOT in a single thread (i.e., the main gui and this algo are in different threads) - will NOT force a graphics update of the progress bar. Should be set to false if in a single thread - will force a graphics update of the progress bar.
      • setSrcImage

        public void setSrcImage​(ModelImage srcImage)
        Sets the source image of the algorithm
        Parameters:
        srcImage - the source image
      • setStartTime

        public void setStartTime()
        Sets the start time to the current time. This should be called at the beginning of the run() method.
      • setThreadStopped

        public void setThreadStopped​(boolean flag)
        Sets the thread stopped to flag indicating if algorithm has stopped.
        Parameters:
        flag - flag to set to
      • startMethod

        public final boolean startMethod​(int priority)
        Checks to see if a thread is already running on this object. If so, it returns false, else it starts the thread and returns true.
        Parameters:
        priority - thread priority
        Returns:
        false if a thread is already running this algorithm, true otherwise
      • windowActivated

        public void windowActivated​(java.awt.event.WindowEvent event)
        Do nothing.
        Specified by:
        windowActivated in interface java.awt.event.WindowListener
        Parameters:
        event - the window activated event
      • windowClosed

        public void windowClosed​(java.awt.event.WindowEvent event)
        Do nothing.
        Specified by:
        windowClosed in interface java.awt.event.WindowListener
        Parameters:
        event - the window closed event
      • windowClosing

        public void windowClosing​(java.awt.event.WindowEvent event)
        Sets completed to false, disposes the progress bar and notifies all listeners that the algorithm is stopped.
        Specified by:
        windowClosing in interface java.awt.event.WindowListener
        Parameters:
        event - event that triggered function
      • windowDeactivated

        public void windowDeactivated​(java.awt.event.WindowEvent event)
        Do nothing.
        Specified by:
        windowDeactivated in interface java.awt.event.WindowListener
        Parameters:
        event - the window deactivated event
      • windowDeiconified

        public void windowDeiconified​(java.awt.event.WindowEvent event)
        Do nothing.
        Specified by:
        windowDeiconified in interface java.awt.event.WindowListener
        Parameters:
        event - the window deiconified event
      • windowIconified

        public void windowIconified​(java.awt.event.WindowEvent event)
        Do nothing.
        Specified by:
        windowIconified in interface java.awt.event.WindowListener
        Parameters:
        event - the window iconified event
      • windowOpened

        public void windowOpened​(java.awt.event.WindowEvent event)
        Do nothing.
        Specified by:
        windowOpened in interface java.awt.event.WindowListener
        Parameters:
        event - the window opened event
      • convertIntoFloat

        protected float[] convertIntoFloat​(java.lang.String[] str)
        Takes an array of strings and converts each entry into a float value. Useful for updating DICOM file information.
        Parameters:
        str - Some number of strings in an array
        Returns:
        An array of floats; the same number of entries in str are returned in the array.
      • fireProgressStateChanged

        protected void fireProgressStateChanged​(java.lang.String message)
        Notifies listeners that have registered interest for notification on this event type.
        Parameters:
        message - the new message to display on the progress bar
      • fireProgressStateChanged

        protected void fireProgressStateChanged​(int value)
        Notifies all listeners that have registered interest for notification on this event type.
        Parameters:
        value - the value of the progress bar.
      • fireProgressStateChanged

        protected void fireProgressStateChanged​(java.lang.String imageName,
                                                java.lang.String message)
        Updates listeners of progress status. Without actually changing the numerical value
        Parameters:
        imageName - the name of the image
        message - the new message to display
      • fireProgressStateChanged

        protected void fireProgressStateChanged​(int value,
                                                java.lang.String title,
                                                java.lang.String message)
        Notifies all listeners that have registered interest for notification on this event type.
        Parameters:
        value - the value of the progress bar.
        title - the title of the progress dialog.
        message - the message for that specific progress value.
      • fireProgressStateChanged

        protected void fireProgressStateChanged​(float fVal,
                                                java.lang.String title,
                                                java.lang.String message)
        Updates listeners of progress status.
        Parameters:
        fVal - the percent progress of the algorithm so far
        title - the title to send to the listeners
        message - the message to send to the listeners
      • linkProgressToAlgorithm

        protected void linkProgressToAlgorithm​(AlgorithmBase baseAlgo)
        Helper function to link the currently listening progress bar with an algorithm created within an algorithm. This function should only be called when the other algorithm is expected to update the progress bar seamlessly. It should be called in conjuction with AlgorithmBase's setProgressValues() so that the sub-algorithm will have know the min and max progress values.

        Generally this will be called with the following lines: linkProgressToAlgorithm(theSubAlgorithm); theSubAlgorithm.setProgressValues(generateProgressValues(currentProgressOfAlgorithm, desiredMaxProgressOfSubAlgorithm));

        Parameters:
        baseAlgo - the subalgorithm created within current algorithm
      • linkProgressToAlgorithm

        protected void linkProgressToAlgorithm​(AlgorithmBase baseAlgo,
                                               java.lang.String title,
                                               int min,
                                               int max)
        New helper function for use with the ViewJProgressBarMulti. This allows for keeping track of multi-threaded algorithms and allow the user to better keep track of multiple processes being run. Any linked algorithms should update together in the manner specificed by min/max.
        Parameters:
        baseAlgo - the subalgorithm created within current algorithm
        title - the title shown in the progress bar panel
        min - the lower bound of the updating portion of the parent algorithm
        max - the upper bound of the updating portion of the parent algorithm
      • delinkProgressToAlgorithm

        protected void delinkProgressToAlgorithm​(AlgorithmBase baseAlgo)
        Disconnect this algorithm with the progress bar which holds a reference to this algorithm. In order to release the memory of this algorithm, this function should be called after the algorithm was finished.
        Parameters:
        baseAlgo -
      • delinkProgressToAlgorithmMulti

        protected void delinkProgressToAlgorithmMulti​(AlgorithmBase baseAlgo)
      • getProgress

        public float getProgress()
      • setProgress

        public void setProgress​(int progress)
      • makeProgress

        public void makeProgress​(float step)
      • getProgressStep

        public float getProgressStep()
      • setProgressStep

        public void setProgressStep​(float progressStep)
      • isMultiThreadingEnabled

        public boolean isMultiThreadingEnabled()
      • setMultiThreadingEnabled

        public void setMultiThreadingEnabled​(boolean multiThreadingEnabled)
      • getNumberOfThreads

        public int getNumberOfThreads()
      • setNumberOfThreads

        public void setNumberOfThreads​(int nthreads)
      • getProgressModulus

        public int getProgressModulus()
      • setProgressModulus

        public void setProgressModulus​(int progressModulus)
      • calculateImageSize

        public static int calculateImageSize​(int[] dims)
        Calculate the size of the image.
        Parameters:
        dims -
        Returns: