public class SnakeHandler extends ShapeHandler<Snake> implements IQuimpSerialize
For any further processing outside QuimP finalSnakes should be used.
endFrame, startFrame
Constructor and Description |
---|
SnakeHandler()
Instantiates a new snake handler.
|
SnakeHandler(List<SegmentedShapeRoi> snakes,
int id)
Copy constructor.
|
SnakeHandler(Roi r,
int frame,
int id)
Constructor of SnakeHandler.
|
Modifier and Type | Method and Description |
---|---|
void |
afterSerialize()
Prepare all Snake stored in this SnakeHandler for loading.
|
void |
backupLiveSnake(int frame)
Stores liveSnake (currently processed) in segSnakes array.
|
void |
backupThisSnake(Snake snake,
int frame)
Makes copy of snake and store it as segmented snake.
|
void |
beforeSerialize()
Prepare all Snake stored in this SnakeHandler for saving.
|
void |
copyFromFinalToLive(int frame)
Copy final snake from frame to liveSnake.
|
void |
copyFromFinalToSeg()
Copy all finalSnakes to segSnakes.
|
void |
copyFromSegToFinal()
Copy all segSnakes to finalSnakes.
|
void |
freezeHandler()
Prevent this handler from segmentation.
|
Snake |
getBackupSnake(int f)
Gets the backup snake.
|
int |
getID()
Gets the id of handler.
|
Snake |
getLiveSnake()
Gets the live snake.
|
Snake |
getStoredSnake(int f)
Return final Snake (after plugins) stored for frame f.
|
boolean |
isLive()
Checks if is live snake is live.
|
boolean |
isSnakeHandlerFrozen()
Return true if this handler is frozen.
|
void |
kill()
Kill.
|
void |
reset()
Reset snakes in handler.
|
void |
revive()
Revive.
|
int |
snakeReader(File inFile)
Deprecated.
|
void |
storeLiveSnake(int frame)
Make copy of liveSnake into final snakes array.
|
void |
storeThisSnake(Snake snake,
int frame)
Makes copy of snake and store it as final snake.
|
String |
toString() |
void |
unfreezeHandler()
Unlock handler.
|
boolean |
writeSnakes()
Write Snakes from this handler to *.snPQ file.
|
getEndFrame, getStartFrame
public SnakeHandler()
public SnakeHandler(Roi r, int frame, int id) throws BoaException
r
- ROI with selected objectframe
- Current frame for which the ROI is takenid
- Unique Snake ID controlled by Nest objectBoaException
- on problem with Snake creationpublic SnakeHandler(List<SegmentedShapeRoi> snakes, int id) throws BoaException
For every frame it copies provided snake to all three arrays: finalSnakes, segSnakes, liveSnake and sets first and last frame using data from SegmentedShapeRoi object
snakes
- List of outlines that will be propagated from first frame. First frame is wrote
down in first element of this listid
- Unique Snake ID controlled by Nest objectBoaException
- on problem with Snake creationSegmentedShapeRoi
public void storeLiveSnake(int frame)
frame
- Frame for which liveSnake will be copied topublic void backupLiveSnake(int frame)
For one SnakeHandler there is only one liveSnake which is processed "in place" by segmentation methods. It is virtually moved from frame to frame and copied to final snakes after segmentation on current frame and processing by plugins. It must be backed up for every frame to make possible restoring original snakes when active plugin has been deselected.
frame
- current framepublic void storeThisSnake(Snake snake, int frame)
snake
- Snake to storeframe
- Frame for which liveSnake will be copied topublic void backupThisSnake(Snake snake, int frame)
snake
- Snake to storeframe
- Frame for which liveSnake will be copied topublic void copyFromSegToFinal()
public void copyFromFinalToSeg()
public void copyFromFinalToLive(int frame)
frame
- frame to copy from (counted from 1)public boolean writeSnakes() throws IOException
IOException
- when the file exists but is a directory rather than a regular file, does
not exist but cannot be created, or cannot be opened for any other reasonpublic Snake getLiveSnake()
public Snake getBackupSnake(int f)
f
- the fpublic Snake getStoredSnake(int f)
f
- frame@Deprecated public int snakeReader(File inFile) throws Exception
May not be compatible wit old version due to changes in Snake constructor.
inFile
- file to readException
- on problempublic void revive()
public void kill()
public void reset() throws BoaException
BoaException
- on snake creation problempublic int getID()
public boolean isLive()
public boolean isSnakeHandlerFrozen()
Frozen handler is excluded from frame segmentation.
freezeHandler()
,
unfreezeHandler()
public void freezeHandler()
unfreezeHandler()
,
isSnakeHandlerFrozen()
,
(zoom action)
public void unfreezeHandler()
freezeHandler()
,
isSnakeHandlerFrozen()
,
(zoom action)
public void beforeSerialize()
beforeSerialize
in interface IQuimpSerialize
Serializer.save(String)
public void afterSerialize() throws Exception
afterSerialize
in interface IQuimpSerialize
Exception
- from wrapped object in any problem. This is implementation dependentSerializer.load(String)
Copyright © 2002–2019 Department of Computer Science, Warwick University. All rights reserved.