com.xinapse.multisliceimage.roi
Enum MaskMode

java.lang.Object
  extended by java.lang.Enum<MaskMode>
      extended by com.xinapse.multisliceimage.roi.MaskMode
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<MaskMode>

public enum MaskMode
extends java.lang.Enum<MaskMode>

An enumeration of possible masking mode. The masking mode determines how much of a pixel must be within an ROI (as a percentage of the pixels's area) for that pixel to be "inside" the ROI.


Nested Class Summary
static class MaskMode.Panel
          A JPanel for selecting a MaskMode.
 
Enum Constant Summary
ALL
          MaskMode such that all of a pixel must be inside an ROI for that pixel to be part of the mask.
ANY
          MaskMode such that if any part of a pixel is inside an ROI, that pixel is part of the mask.
HALF
          MaskMode such that if at least 50% of a pixel is inside an ROI, that pixel is part of the mask.
 
Method Summary
static MaskMode getInstance(java.lang.String modeString)
          Returns a MaskMode corresponding to the supplied String.
static MaskMode getPreferredMaskMode(java.util.prefs.Preferences prefs, MaskMode defaultMaskMode)
          Returns the MaskMode set in the UserPreferences, or the default MaskMode, if none is set in the Preferences.
 java.lang.String getToolTipString()
          Returns a String that is useful for building a ToolTip or description of this MaskMode.
static void savePreferences(MaskMode maskMode, java.util.prefs.Preferences prefs)
          Saves the supplied MaskMode as the user's preferrred MaskMode.
 double threshold()
          Returns the pixel area threshold for this MaskMode as a fraction of the pixel's area.
static MaskMode valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static MaskMode[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

ANY

public static final MaskMode ANY
MaskMode such that if any part of a pixel is inside an ROI, that pixel is part of the mask.


HALF

public static final MaskMode HALF
MaskMode such that if at least 50% of a pixel is inside an ROI, that pixel is part of the mask.


ALL

public static final MaskMode ALL
MaskMode such that all of a pixel must be inside an ROI for that pixel to be part of the mask.

Method Detail

values

public static MaskMode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (MaskMode c : MaskMode.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static MaskMode valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

getInstance

public static MaskMode getInstance(java.lang.String modeString)
                            throws com.xinapse.util.InvalidArgumentException
Returns a MaskMode corresponding to the supplied String.

Returns:
the mask mode whose name matches the supplied String.
Throws:
com.xinapse.util.InvalidArgumentException - if the supplied String does not match any mask mode name.

getToolTipString

public java.lang.String getToolTipString()
Returns a String that is useful for building a ToolTip or description of this MaskMode.

Returns:
a String that is useful for building a ToolTip or description of this MaskMode.

threshold

public double threshold()
Returns the pixel area threshold for this MaskMode as a fraction of the pixel's area.

Returns:
the fraction of a pixel's area that must be within an ROI for that pixel to be part of the mask.

savePreferences

public static void savePreferences(MaskMode maskMode,
                                   java.util.prefs.Preferences prefs)
Saves the supplied MaskMode as the user's preferrred MaskMode.

Parameters:
maskMode - the MaskMode to save in the user's preferences.
prefs - the user Preferences in which to save the MaskMode.

getPreferredMaskMode

public static MaskMode getPreferredMaskMode(java.util.prefs.Preferences prefs,
                                            MaskMode defaultMaskMode)
Returns the MaskMode set in the UserPreferences, or the default MaskMode, if none is set in the Preferences.

Parameters:
prefs - the user Preferences in which to look for the preferred MaskMode.
defaultMaskMode - the default to return if the preferred MaskMode cannot be found in the user Preferences.
Returns:
the user's preferred MaskMode.


Copyright 2006-2011 Xinapse Systems Limited. All Rights Reserved.