de.unihalle.informatik.MiToBo.segmentation.levelset.nonPDE
Class MTBLevelsetMembership

java.lang.Object
  extended by de.unihalle.informatik.Alida.operator.ALDData
      extended by de.unihalle.informatik.MiToBo.segmentation.levelset.nonPDE.MTBLevelsetMembership

public class MTBLevelsetMembership
extends de.unihalle.informatik.Alida.operator.ALDData

A class to hold a level set function where only the memership to a phase is required and represented. Background pixels gets phase BG_PHASE, object phases start with BG_PHASE+1. The implementation asserts that all phases > BG_PHASE are indeed object phases. Value INVALID_PHASE is reserved for invalid pixels.


Field Summary
static byte BG_PHASE
          Level set function value to represent the background phase
static byte INVALID_PHASE
          Level set function value to represent invalid pixels
static int MAX_ALLOWED_NUM_PHASES
          Maximal number of phases which may be represented including background phase.
 
Constructor Summary
MTBLevelsetMembership(int sizeX, int sizeY, int sizeZ)
          Constructs a two phase level set function which is initialiazed with a circle or sphere of radius 0.5*(sizeX+sizeY+sizeZ)/3.
MTBLevelsetMembership(int sizeX, int sizeY, int sizeZ, MTBImage invalidImg)
          Constructs a two phase level set function which is initialiazed with a circle or sphere of radius 0.5*(sizeX+sizeY+sizeZ)/3.
MTBLevelsetMembership(int sizeX, int sizeY, int sizeZ, MTBImage img, int threshold, MTBImage invalidImg)
          Creates a two phase level set function from an image via thresholding.
MTBLevelsetMembership(int sizeX, int sizeY, MTBRegion2DSet regions, MTBImage invalidImg, boolean multiphase)
          Constructor for given size which is initialized from a MTBRegion2DSet for a 2D level set function.
MTBLevelsetMembership(int sizeX, int sizeY, Vector<MTBRegion2D> regions, MTBImage invalidImg, boolean multiphase)
          Constructor for given size which is initialized from a list of 2D regions for a 2D level set function.
MTBLevelsetMembership(MTBImage initLabelImg, MTBImage invalidImg)
          Constructor for a two phase level set function from a label image.
MTBLevelsetMembership(MTBImage initLabelImg, MTBImage invalidImg, boolean multiphase)
          Constructor for a level set function from a label image.
MTBLevelsetMembership(MTBLevelsetMembership phi)
          Creates a copy of phi.
 
Method Summary
 void changePhase(int x, int y, byte phase)
          Change a pixel to a new phase.
 void changePhase(int x, int y, int z, byte phase)
          Change a pixel/voxel to a new phase.
 MTBImageByte getMTBImage()
          Creates a bi-level MTBImageByte of the level set function.
 MTBImageByte getMTBImageLabel()
          Creates a MTBImageByte of the level set function.
 int getNumPhases()
          Return .e. number phases.
 byte getPhase(int x, int y)
          Return phase for a pixel/voxel, z coordinate defaults to zero
 byte getPhase(int x, int y, int z)
          Return phase for a pixel/voxel
 byte getPhaseCheckXY(int x, int y)
          Return phase for a pixel checking limits of all coordinates.
 byte getPhaseCheckXYZ(int x, int y, int z)
          Return phase for a pixel/voxel checking limits of all coordinates.
 int getPixelInside()
          Return number of pixels of all object phases.
 int getPixelOutside()
          Return number of pixels of background phase.
 int getSizePhase(byte phase)
          Return the size, i.e. number of pixel/voxels of a phase.
 int getSizeX()
          Return X size of the level set function.
 int getSizeY()
          Return Y size of the level set function.
 int getSizeZ()
          Return Z size of the level set function.
 boolean isValid(MTBImage invalidImg, int x, int y, int z)
          returns true, if pixel/voxel is valid.
 String toString()
          Return a string representation.
 
Methods inherited from class de.unihalle.informatik.Alida.operator.ALDData
cloneProperties, getLocation, getProperty, getPropertyKeys, print, setLocation, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BG_PHASE

public static final byte BG_PHASE
Level set function value to represent the background phase

See Also:
Constant Field Values

INVALID_PHASE

public static final byte INVALID_PHASE
Level set function value to represent invalid pixels

See Also:
Constant Field Values

MAX_ALLOWED_NUM_PHASES

public static final int MAX_ALLOWED_NUM_PHASES
Maximal number of phases which may be represented including background phase.

See Also:
Constant Field Values
Constructor Detail

MTBLevelsetMembership

public MTBLevelsetMembership(int sizeX,
                             int sizeY,
                             int sizeZ)
Constructs a two phase level set function which is initialiazed with a circle or sphere of radius 0.5*(sizeX+sizeY+sizeZ)/3.

Parameters:
sizeX -
sizeY -
sizeZ -

MTBLevelsetMembership

public MTBLevelsetMembership(int sizeX,
                             int sizeY,
                             int sizeZ,
                             MTBImage invalidImg)
Constructs a two phase level set function which is initialiazed with a circle or sphere of radius 0.5*(sizeX+sizeY+sizeZ)/3.

If invalidImg is non null, than pixels <> zero in invalidImg are invalid

Parameters:
sizeX -
sizeY -
sizeZ -
invalidImg -

MTBLevelsetMembership

public MTBLevelsetMembership(int sizeX,
                             int sizeY,
                             int sizeZ,
                             MTBImage img,
                             int threshold,
                             MTBImage invalidImg)
Creates a two phase level set function from an image via thresholding. All pixels with intensities greater equal the threshold constitute the object phase, other pixels the background.

If invalidImg is non null, than pixels <> zero in invalidImg are invalid

Parameters:
sizeX -
sizeY -
sizeZ -
img - Images tp be thresholded
threshold - All pixels with intensities greater equal are object pixels
invalidImg -

MTBLevelsetMembership

public MTBLevelsetMembership(MTBLevelsetMembership phi)
Creates a copy of phi.

Parameters:
phi - levelset function to copy

MTBLevelsetMembership

public MTBLevelsetMembership(int sizeX,
                             int sizeY,
                             Vector<MTBRegion2D> regions,
                             MTBImage invalidImg,
                             boolean multiphase)
Constructor for given size which is initialized from a list of 2D regions for a 2D level set function. If multiphase is true, then each region yields on phase thus the number of regions determines the the number of phases. If multiphase is false, exactly one object phase is populated from all regions.

If invalidImg is non null, than pixels <> zero in invalidImg are invalid

Parameters:
sizeX -
sizeY -
regions - Vector of regions to initialize from
invalidImg - pixels which are non zero are assumed invalid
multiphase - if true create one phase for each region, otherwise two phases

MTBLevelsetMembership

public MTBLevelsetMembership(int sizeX,
                             int sizeY,
                             MTBRegion2DSet regions,
                             MTBImage invalidImg,
                             boolean multiphase)
Constructor for given size which is initialized from a MTBRegion2DSet for a 2D level set function. If multiphase is true, each region yields on phase thus the number of regions determines the the number of phases. If multiphase is true, then each region yields on phase thus the number of regions determines the the number of phases. If mutliphase is false, exactly one object phase is populated from all regions. If invalidImg is non null, than pixels <> zero in invalidImg are invalid

Parameters:
sizeX -
sizeY -
regions - Region2D set to initialize from
invalidImg - pixels which are non zero are assumed invalid
multiphase - if true create one phase for each region, otherwise two phases

MTBLevelsetMembership

public MTBLevelsetMembership(MTBImage initLabelImg,
                             MTBImage invalidImg)
Constructor for a two phase level set function from a label image. Label zero is interpreted as background, everything else as foreground, e.g. the only object phase. If invalidImg is non null, than pixels <> zero in invalidImg are invalid

Parameters:
initLabelImg - Label image for initialization
invalidImg - Image indicating invalid pixels with values <> 0

MTBLevelsetMembership

public MTBLevelsetMembership(MTBImage initLabelImg,
                             MTBImage invalidImg,
                             boolean multiphase)
Constructor for a level set function from a label image. if multiphase is true, then a multi phase level set function is created, where labels ared interpreted as phases (a label of zero indeicated background). Otherwise a two phase level set function is created, where all non zero labels are interpreted as foreground.

If invalidImg is non null, than pixels <> zero in invalidImg are invalid

Parameters:
initLabelImg - Label image for initialization
invalidImg - Image indicating invalid pixels with values <> 0
Method Detail

changePhase

public void changePhase(int x,
                        int y,
                        int z,
                        byte phase)
Change a pixel/voxel to a new phase. Note: validity of phase is NOT checked.

Parameters:
x -
y -
z -
phase -

changePhase

public void changePhase(int x,
                        int y,
                        byte phase)
Change a pixel to a new phase. Note: validity of phase is NOT checked.

Parameters:
x -
y -
phase -

getPhase

public byte getPhase(int x,
                     int y,
                     int z)
Return phase for a pixel/voxel

Parameters:
x -
y -
z -

getPhaseCheckXYZ

public byte getPhaseCheckXYZ(int x,
                             int y,
                             int z)
Return phase for a pixel/voxel checking limits of all coordinates. If coordinates are invalid, INVALID_PHASE is returned.

Parameters:
x -
y -
z -
Returns:
phase

getPhase

public byte getPhase(int x,
                     int y)
Return phase for a pixel/voxel, z coordinate defaults to zero

Parameters:
x -
y -

getPhaseCheckXY

public byte getPhaseCheckXY(int x,
                            int y)
Return phase for a pixel checking limits of all coordinates. If coordinates are invalid, INVALID_PHASE is returned.

Parameters:
x -
y -
Returns:
phase

getMTBImage

public MTBImageByte getMTBImage()
Creates a bi-level MTBImageByte of the level set function. Background and invalid pixels get intensity 0, object pixels intensity 255.

Returns:
MTBImage

getMTBImageLabel

public MTBImageByte getMTBImageLabel()
Creates a MTBImageByte of the level set function. Background and invalid pixels get value 0, the object phases get values starting with 1

Returns:
MTBImageByte

getPixelInside

public int getPixelInside()
Return number of pixels of all object phases.


getPixelOutside

public int getPixelOutside()
Return number of pixels of background phase.


getSizeX

public int getSizeX()
Return X size of the level set function.


getSizeY

public int getSizeY()
Return Y size of the level set function.


getSizeZ

public int getSizeZ()
Return Z size of the level set function.


getSizePhase

public int getSizePhase(byte phase)
Return the size, i.e. number of pixel/voxels of a phase.


getNumPhases

public int getNumPhases()
Return .e. number phases.


toString

public String toString()
Return a string representation.

Overrides:
toString in class Object

isValid

public boolean isValid(MTBImage invalidImg,
                       int x,
                       int y,
                       int z)
returns true, if pixel/voxel is valid. Valid pixels are define as zero pixels (i.e. invalid pixels are marks with phase not equal to zero

Parameters:
invalidImg -
x -
y -
z -


Copyright © 2010–2015 Martin Luther University Halle-Wittenberg. All rights reserved.