snakeprogram3d
Class SnakeModel

java.lang.Object
  extended by snakeprogram3d.SnakeModel

public class SnakeModel
extends java.lang.Object


Method Summary
 void addSnake()
          Starts the initialize snake process where SnakeRaw? are the transient snake coordinates.
 void autoDetectIntensities()
          Tries to determine the forground/background values automatically.
 boolean checkForCurrentSnake()
          This is used before attempting to modify the current snake such as with a fix or deform button press.
 void clearCurrentSnake()
           
 void clearScreen()
          removes all snakes from the current frame
 void decreaseMax()
          for adjusting brightness/contrast
 void decreaseMin()
          for adjusting brightness/contrast
 void deformRunning()
          Deforms the Current Snake.
 void deformSnake()
          Causes the deformation of a snake to occur
 void deleteEndFix()
          Disables UI and Deletes and end
 void deleteMiddleFix()
          Disables the UI and begins the Delete Middle fix
 void deleteSnake()
          deletes the current snake and selects the next one
 void deleteSnake(Snake s)
          Delets a snake
 void disableUI()
          stops any other input except for the MouseListener on the displayed Image
 void enableUI()
          enables buttons
 void finishDisplay()
          Creates volume data and submits the job to the main process.
 java.lang.String formatNumber(double value)
          Limits the display to two decimal points, or scientific notation if the number is out of a certain range.
 void getAndLoadImage()
          These are short access to images so the frame doesn't need to know about the SnakeImages class
 void getBackgroundIntensity()
          Sets the flag so the next time the snake panel is clicked background intesity will be calcularted
 double[] getClosestSnakePoint(double x, double y, double z)
          For getting the closest point on the current snake.
 int getDeformIterations()
           
 int getDrawHeight()
          short access to images so the frame doesn't need to know about the SnakeImages class
 int getDrawWidth()
          These are short access to images so the frame doesn't need to know about the SnakeImages class
 void getForegroundIntensity()
          Sets the flag so the next time the snake panel is clicked foreground intesity will be calcularted
 javax.swing.JFrame getFrame()
          Gets the frame used for dialogs.
 java.awt.Image getImage()
          short access to images so the frame doesn't need to know about the SnakeImages class
 java.lang.String getImageTitle()
          gets the filename of the open imageplus.
 int getNFrames()
           
 int getNSlices()
           
 boolean hasImage()
          After an image has been opened to make sure it has properly been loaded.
 void increaseMax()
          for adjusting brightness/contrast
 void increaseMin()
          for adjusting brightness/contrast
 void initializeZoomIn()
          Disables UI and begins a zoom in routine
 void loadImage(ij.ImagePlus implus)
          Loads an image from an existing image plus the principle useage of this function is to load an image when started through ImageJ.
 void loadSnake()
          Loads a snake from a file and sets the constant values in the snake panel.
 void mouseMoved(ThreeDEvent tde)
          Generated during a mouse move event, from 2d panel or the 3d views.
 void mousePressed(ThreeDEvent tde)
          Handles all mouse events in the 3d image coordnate space.
 void moveDown()
          Moves the YZ plane
 void moveUp()
          Moves the YZ plane
 void nextFrame()
          Next volume stack in time.
 void nextImage()
          moves to the next image
 void previousFrame()
          Previous volume stack in time.
 void previousImage()
          moves to the previous image
 void reduce3D(boolean t)
          Causes the model to use a reduced version of the 3d image.
 void saveElongationData()
          Save all of the snakes elongation data
 void saveSnake()
          Save all of the snakes data, so that they may be reloaded
 void selectNextSnake()
           
 void selectSnake(java.awt.event.MouseEvent evt)
          A MouseEvent version of the snake selector
 void selectSnake(ThreeDEvent tde)
          Chooses the nearest snake.
 void setAlpha(double a)
           
 void setBackgroundIntensity(double fim)
           
 void setBeta(double b)
           
 void setDefaultConstants()
           
 void setDeformIterations(int di)
           
 void setFixSnakePoints()
          Sets the flag so the next click on the image pane extends the snake to the click location
 void setForegroundIntensity(double f)
           
 void setGamma(double g)
           
 void setImageSmoothing(double v)
          sets the sigma of the image smoothing term.
 void setMaxDrawingBounds(int W, int H)
          When the view changes size this can be 800 or 400, should be scalable though.
 void setResolution(double res)
           
 void setStretch(double s)
           
 void setWeight(double w)
           
 void setZResolution(double mon)
          Sets the zresolution and refreshes the display.
 void snakePanelMouseMoved(java.awt.event.MouseEvent evt)
          Handles two types of mouse moved events.
 void snakePanelMousePressed(java.awt.event.MouseEvent evt)
          When the mouse is pressed over the snake panel, transforms the click to a 3d event
 void stopRunningNicely()
          Causes a deform iterations
 void switchCards()
          For changing the view configuration.
 void trackSnake()
          Goes to the next frame and copies the current snake.
 void trackSnakeBackwards()
          Goes to the previous frame and copies the current snake.
 void updateDisplay()
          Updates both displays.
 void updateFrame()
           
 void updateImagePanel()
          Updates the image panel and relevant properties.
 void updateThreeDDisplay()
          updates the snakes positions, should be called from the PROC thread.
 void validateSnakes()
           
 void wipeDown()
           
 void wipeUp()
           
 void zoomOut()
          resets the zoom to the orginal image size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

deformRunning

public void deformRunning()
                   throws java.lang.IllegalAccessException
Deforms the Current Snake. This method should not be executed on the event thread but instead should be placed on the Snake event loop, PROC.

Throws:
java.lang.IllegalAccessException - occurs when the snake is too short.

snakePanelMousePressed

public void snakePanelMousePressed(java.awt.event.MouseEvent evt)
When the mouse is pressed over the snake panel, transforms the click to a 3d event

Parameters:
evt - the generated mouse event.

mousePressed

public void mousePressed(ThreeDEvent tde)
Handles all mouse events in the 3d image coordnate space.

Parameters:
tde - Event that is handled in 3d image space.

snakePanelMouseMoved

public void snakePanelMouseMoved(java.awt.event.MouseEvent evt)
Handles two types of mouse moved events. 2d Events are processed for zooming and adding a snake. Then a 3d event is generated for updating the 3d views.

Parameters:
evt - mouse event.

mouseMoved

public void mouseMoved(ThreeDEvent tde)
Generated during a mouse move event, from 2d panel or the 3d views.

Parameters:
tde - event in image space

getClosestSnakePoint

public double[] getClosestSnakePoint(double x,
                                     double y,
                                     double z)
For getting the closest point on the current snake.

Parameters:
x - cnet
y - cnet
z - cnet
Returns:
xyz array.

formatNumber

public java.lang.String formatNumber(double value)
Limits the display to two decimal points, or scientific notation if the number is out of a certain range.

Parameters:
value - number to be represented by a string
Returns:
string

selectSnake

public void selectSnake(java.awt.event.MouseEvent evt)
A MouseEvent version of the snake selector

Parameters:
evt - original mouse event.

selectSnake

public void selectSnake(ThreeDEvent tde)
Chooses the nearest snake. This method is called by another listener added by the snake_frame which is enabled or disable along with the rest of the GUI.

Parameters:
tde - image space

saveElongationData

public void saveElongationData()
Save all of the snakes elongation data


saveSnake

public void saveSnake()
Save all of the snakes data, so that they may be reloaded


loadSnake

public void loadSnake()
Loads a snake from a file and sets the constant values in the snake panel.


trackSnake

public void trackSnake()
Goes to the next frame and copies the current snake. then deforms that snake.


trackSnakeBackwards

public void trackSnakeBackwards()
Goes to the previous frame and copies the current snake. then deforms that snake.


deleteMiddleFix

public void deleteMiddleFix()
Disables the UI and begins the Delete Middle fix


deleteEndFix

public void deleteEndFix()
Disables UI and Deletes and end


previousImage

public void previousImage()
moves to the previous image


nextImage

public void nextImage()
moves to the next image


initializeZoomIn

public void initializeZoomIn()
Disables UI and begins a zoom in routine


deleteSnake

public void deleteSnake()
deletes the current snake and selects the next one


deleteSnake

public void deleteSnake(Snake s)
Delets a snake

Parameters:
s - the snake that will be deleted.

clearScreen

public void clearScreen()
removes all snakes from the current frame


getForegroundIntensity

public void getForegroundIntensity()
Sets the flag so the next time the snake panel is clicked foreground intesity will be calcularted


getBackgroundIntensity

public void getBackgroundIntensity()
Sets the flag so the next time the snake panel is clicked background intesity will be calcularted


zoomOut

public void zoomOut()
resets the zoom to the orginal image size


addSnake

public void addSnake()
Starts the initialize snake process where SnakeRaw? are the transient snake coordinates.


deformSnake

public void deformSnake()
Causes the deformation of a snake to occur


setFixSnakePoints

public void setFixSnakePoints()
Sets the flag so the next click on the image pane extends the snake to the click location


getAndLoadImage

public void getAndLoadImage()
These are short access to images so the frame doesn't need to know about the SnakeImages class


autoDetectIntensities

public void autoDetectIntensities()
Tries to determine the forground/background values automatically. Usually fails.


getDrawHeight

public int getDrawHeight()
short access to images so the frame doesn't need to know about the SnakeImages class

Returns:
height of space for drawing image.

getImage

public java.awt.Image getImage()
short access to images so the frame doesn't need to know about the SnakeImages class

Returns:
awt version of image.

getDrawWidth

public int getDrawWidth()
These are short access to images so the frame doesn't need to know about the SnakeImages class

Returns:
width available for drawing image.

getFrame

public javax.swing.JFrame getFrame()
Gets the frame used for dialogs.

Returns:
main frame of application

getNSlices

public int getNSlices()
Returns:
number of slices per frame

getNFrames

public int getNFrames()
Returns:
number of frames.

hasImage

public boolean hasImage()
After an image has been opened to make sure it has properly been loaded.

Returns:
image ready

getDeformIterations

public int getDeformIterations()
Returns:
the number of iterations when deform iterations is clicked.

setDeformIterations

public void setDeformIterations(int di)
Parameters:
di - number of iterations per deform iteration click.

setZResolution

public void setZResolution(double mon)
Sets the zresolution and refreshes the display.

Parameters:
mon - zspacing

setResolution

public void setResolution(double res)

setBackgroundIntensity

public void setBackgroundIntensity(double fim)

setForegroundIntensity

public void setForegroundIntensity(double f)

setAlpha

public void setAlpha(double a)

setBeta

public void setBeta(double b)

setGamma

public void setGamma(double g)

setWeight

public void setWeight(double w)

setStretch

public void setStretch(double s)

setImageSmoothing

public void setImageSmoothing(double v)
sets the sigma of the image smoothing term.

Parameters:
v - standard deviation of the gaussian filter.

loadImage

public void loadImage(ij.ImagePlus implus)
Loads an image from an existing image plus the principle useage of this function is to load an image when started through ImageJ.

Parameters:
implus - the ImagePlus preloaded via ImageJ

finishDisplay

public void finishDisplay()
Creates volume data and submits the job to the main process. this is called whenever the zresolution changes, image smoothing changes, +/- MIN & MAX changes.


updateDisplay

public void updateDisplay()
Updates both displays.


updateImagePanel

public void updateImagePanel()
Updates the image panel and relevant properties.


updateThreeDDisplay

public void updateThreeDDisplay()
updates the snakes positions, should be called from the PROC thread.


disableUI

public void disableUI()
stops any other input except for the MouseListener on the displayed Image


enableUI

public void enableUI()
enables buttons


checkForCurrentSnake

public boolean checkForCurrentSnake()
This is used before attempting to modify the current snake such as with a fix or deform button press.

Returns:
current snake is set.

stopRunningNicely

public void stopRunningNicely()
Causes a deform iterations


getImageTitle

public java.lang.String getImageTitle()
gets the filename of the open imageplus.

Returns:
name of image

moveUp

public void moveUp()
Moves the YZ plane


moveDown

public void moveDown()
Moves the YZ plane


wipeDown

public void wipeDown()

wipeUp

public void wipeUp()

switchCards

public void switchCards()
For changing the view configuration.


setMaxDrawingBounds

public void setMaxDrawingBounds(int W,
                                int H)
When the view changes size this can be 800 or 400, should be scalable though.

Parameters:
W - width
H - height

nextFrame

public void nextFrame()
Next volume stack in time.


previousFrame

public void previousFrame()
Previous volume stack in time.


increaseMax

public void increaseMax()
for adjusting brightness/contrast


decreaseMax

public void decreaseMax()
for adjusting brightness/contrast


increaseMin

public void increaseMin()
for adjusting brightness/contrast


decreaseMin

public void decreaseMin()
for adjusting brightness/contrast


updateFrame

public void updateFrame()

setDefaultConstants

public void setDefaultConstants()

reduce3D

public void reduce3D(boolean t)
Causes the model to use a reduced version of the 3d image.

Parameters:
t - Real resolution when false, and reduced resolution when true.

selectNextSnake

public void selectNextSnake()

clearCurrentSnake

public void clearCurrentSnake()

validateSnakes

public void validateSnakes()