Since it is now possible to perform segmentation in rotated slices there should be an undo functionality for that. Currently contours which are drawn into rotated slices cannot be undone because there is no proper operation type and operation actor for that.
Description
Status | Assigned | Task | ||
---|---|---|---|---|
Duplicate | None | T6417 Allow contouring for rotated slices | ||
Resolved | None | T7994 Realize undo functionality for the segmentation in rotated planes |
Event Timeline
For not rotated planes the creation of undo/redo information happens as follows:
- When writing the extracted image slice back, the according difference image is created simultaneously by subtracting the corresponding pixel values of the original image slice from the recently changed image slice.
- Then the do/undo operations are generated. These operations save the original image volume, the difference image slice, the timestep, slice dimension and slice index.
- Both operations are then stored in the operation event and then send to the UndoController.
- If the Undo/Redo Button is pressed, these operations are invoked by the mitkDiffImageApplier. The DiffImageApplier applies the difference image slice to the related slice of the original image volume.
My suggestion for enhancing this so that it works with rotated slices is:
- The creation of the difference image slice takes places analogous (but for rotated slices of course in the mitkOverwriteDirectedPlaneImageFilter)
- Adapt the ApplyDiffImageOperation so that not only sliceindex and dimension can be stored but the geometry of a rotated slice. Or we could make a new operation class for that.
- Perhaps we can distinguish between two different operation types. As I can see at the moment the operation type of an ApplyDiffImageOperation is OpTEST. We could changed that to e.g. OpApplyStandardDiffImage and create another one e.g. OpAppyRotatedDiffImage and then switch between the two cases in the DiffImageApplier. In the DiffImageApplier there should also be a new function that can handle the application of the DiffImage for rotated slices.
Any comments on that?
How does the application know when to "write" on a "normal" slice and when is it considered rotated? If the application does know a difference between these two cases, then handling them by separate operations seems sensible.
If a segmentation tool is used then first of all the currently selected image slice is determined in the according tool subclass. (e.g. mitkContourTool in the function OnMouseReleased).
This is done via the static function SegTool2D::DetermineAffectedImageSlice. If this function returns true we have a normal slice else if false is returned the slice is rotated.
Depending on that either the mitkExtractImageFilter and mitkOverwriteSliceImageFilter are used (for normal slices) or the mitkExtractDirectedPlaneImageFilterNew and the mitkOverwriteDirectedPlaneImageFilter are used for rotated slices.
The creation of the undo/redo information happens in the overwritefilter classes. We could create in each overwrite filter the undo/redo operation pairs but with different operation types (as I mentioned in my previous comment).
Finally the DiffImageApplier could distinguish between this two new operation types by himself.
Resetting all bugs without active assignee flag to "CONFIRMED". Change status to IN_PROGRESS if you are working on it.
For the realization of this feature a new filter for overwriting slices in rotated planes had to be implemented. vtkImageOverwrite is based on vtkImageReslice and working together mitkExtractSliceFilter (see T10333). The filter replaces the two overwrite-filters currently used by mitk's segmentation module. With vtkImageOverwrite it was possible to define an operation and its appropriate applier to enable undo functionality.
In the segmentation workflow there are two operations instantiated within mitkSegTool2D. One is the undo operation representing the state of a slice before editing and the other one (redo) represents the state after a segmentation was done. Both are then put on the undo stack.
[fcfbfe]: Merge branch 'bug-7994-undo-functionality-for-segmentation'
Merged commits:
2012-06-28 16:06:12 Tobias Schroeder [0d58bb]
added prefix in files.cmake
2012-06-22 14:52:14 Tobias Schroeder [50bcd7]
missing mitk prefix in header includes
2012-06-22 14:11:32 Tobias Schroeder [53805c]
marked unused overwrite filters as deprecated
2012-06-22 13:52:57 Tobias Schroeder [00fc30]
track renamed files
2012-06-22 13:52:01 Tobias Schroeder [debfc6]
marked unused mpr filters as deprecated
2012-06-22 13:36:16 Tobias Schroeder [35da68]
use prefix mitk in filename
2012-06-22 13:26:29 Tobias Schroeder [9cd67d]
changed copyright header to current version
2012-06-22 13:23:01 Tobias Schroeder [e4afd0]
Create a testdriver for segmentation module
2012-06-22 13:06:50 Tobias Schroeder [82871a]
moved test class of mitkVtkImageOverwrite from core to segmentation module
2012-06-14 16:45:30 Tobias Schroeder [61e202]
documentation
2012-06-14 13:14:37 Tobias Schroeder [55e6aa]
changed copyright headers
2012-06-14 13:04:53 Tobias Schroeder [6070cd]
include segmentationExport header
2012-06-14 12:45:35 Tobias Schroeder [f1de4b]
moved Undo classes for segmentation to appropriate module segmentation
2012-05-31 18:21:16 Tobias Schroeder [ba283c]
resolved merge conflicts
2012-05-31 18:14:23 Tobias Schroeder [b66116]
resolved merge conflicts
2012-05-03 12:59:34 Tobias Schroeder [5d4813]
adapting the bounds of the slice
2012-04-10 11:40:56 Tobias Schroeder [3ee249]
resolved conflicts
2012-04-10 09:50:17 Tobias Schroeder [5f14b1]
moved origin recalculation to extractslicefilter
2012-04-10 09:27:01 Tobias Schroeder [37a913]
property for slice geometry added to operation
2012-03-29 17:17:09 Tobias Schroeder [44870c]
moved shifting the origin of the image geometry to extract filter
2012-03-09 15:04:02 Tobias Schroeder [1eeb44]
documentation
2012-03-09 11:28:00 Tobias Schroeder [65faa7]
undo feature is working for segmentation - even in oblique planes
2012-03-07 17:33:50 Tobias Schroeder [729168]
Use the operations in segTool2D - not working yet
2012-03-07 17:33:19 Tobias Schroeder [c0a077]
Initial operationActor class
2012-03-07 17:32:38 Tobias Schroeder [c072a3]
Initial operation class
2012-03-07 09:29:14 Tobias Schroeder [425ba1]
added empty files
2012-03-07 09:20:57 Tobias Schroeder [9d2105]
added empty classes
2012-02-17 11:25:34 Tobias Schroeder [b60761]
renamed overwrite filter
2012-02-17 10:52:45 Tobias Schroeder [900475]
change interpoltion to nearest neighbor
2012-02-17 08:48:24 Andreas Fetzer [6296e8]
Removed unused include
2012-02-17 08:43:06 Andreas Fetzer [1cb9db]
Merge branch 'bug-10333-implement-an-overwriteImageFilter-based-on-vtkImageReslice', remote-tracking branch 'origin/bug-10333-implement-an-overwriteImageFilter-based-on-vtkImageReslice' into bug-10333-implement-an-overwriteImageFilter-based-on-vtkImageReslice
2012-02-17 08:40:06 Andreas Fetzer [d62712]
Merge branch 'bug-10333-implement-an-overwriteImageFilter-based-on-vtkImageReslice', remote-tracking branch 'origin/bug-10333-implement-an-overwriteImageFilter-based-on-vtkImageReslice' into bug-10333-implement-an-overwriteImageFilter-based-on-vtkImageReslice
2012-02-16 14:26:35 Tobias Schroeder [20cd50]
Merge branch 'bug-10333-implement-an-overwriteImageFilter-based-on-vtkImageReslice' of mitk.org:MITK into bug-10333-implement-an-overwriteImageFilter-based-on-vtkImageReslice
2012-02-16 13:26:54 Tobias Schroeder [30575b]
removed alternaitve method for overwriting by map
2012-02-16 13:15:44 Tobias Schroeder [03fef9]
cleaned up tests
2012-02-16 10:13:03 Tobias Schroeder [a3fa0c]
overwrite property as a member of the class
2012-02-16 10:12:24 Tobias Schroeder [5d0211]
documentation for overfilter class
2012-02-15 13:30:15 Tobias Schroeder [4f8633]
documentation
2012-02-15 10:39:57 Tobias Schroeder [0c8e27]
use an overwritefilter inherited from vtkimagereslice
2012-02-16 12:53:21 Tobias Schroeder [dd1145]
forgot to delete
2012-02-16 10:13:03 Tobias Schroeder [ea2a35]
overwrite property as a member of the class
2012-02-16 10:12:24 Tobias Schroeder [200409]
documentation for overfilter class
2012-02-15 13:30:15 Tobias Schroeder [e8798b]
documentation
2012-02-15 10:39:57 Tobias Schroeder [a21429]
use an overwritefilter inherited from vtkimagereslice
2012-02-13 14:10:46 Tobias Schroeder [9e19da]
overwriting slices for segmentation is working for oblique planes now. just if a plane is rotated in two directions, everything crashes.
2012-02-13 14:07:33 Tobias Schroeder [3b6ad1]
added override method for setoutputextent and setoutputorigin
2012-02-13 14:05:07 Tobias Schroeder [8dd2f5]
added a test for overwriting in oblique directions
2012-02-08 09:36:38 Tobias Schroeder [17c109]
map image with type unsigned int
2012-02-08 09:33:36 Tobias Schroeder [c6fc01]
SegTool2D uses the new Filters, everything is working except for a shift in oblique planes
2012-02-08 09:30:46 Tobias Schroeder [e03136]
call only one overloaded mehtod
2012-02-07 11:19:13 Tobias Schroeder [ed9fba]
reset startindex in destructor
2012-02-07 11:18:30 Tobias Schroeder [5fd56b]
test large volume to make map reslice fail if type overflow
2012-02-07 11:14:16 Tobias Schroeder [c93118]
reset overwrite mode in destructor
2012-02-06 11:39:21 Tobias Schroeder [059d2c]
reset to default - mitkImageVtkMapper2D
2012-02-06 11:38:21 Tobias Schroeder [d4ea23]
Test new pointer based variant with setter for slice
2012-02-06 11:37:28 Tobias Schroeder [c4748e]
Renamed classes
2012-02-06 10:27:18 Tobias Schroeder [f52eac]
Test for map reslice
2012-02-06 10:22:58 Tobias Schroeder [c9c936]
added extract filter creating maps of memory
2012-02-06 09:02:17 Tobias Schroeder [bb1312]
vtkImageMapReslice is working by setting a mode - changing the inPtr with the outPtr
2012-02-06 09:00:48 Tobias Schroeder [391e97]
improved testing method
2012-02-03 15:30:16 Tobias Schroeder [17bb9a]
tests expanded, not working
2012-02-03 15:29:43 Tobias Schroeder [a84495]
init overwrite filter
2012-02-03 12:58:07 Tobias Schroeder [749a9b]
init testmethod
2012-02-03 12:57:44 Tobias Schroeder [a87f90]
setter for both mitk::Image and vtkImageData
2012-02-03 10:48:26 Tobias Schroeder [5330ba]
intial class documentation
2012-02-03 10:46:20 Tobias Schroeder [632bd2]
added required includes
2012-02-03 10:45:42 Tobias Schroeder [7c6680]
seems to be a merging failure
2012-02-03 10:25:33 Tobias Schroeder [ca9ef2]
init testfile for mitkOverwriteSliceFilter
2012-02-03 10:13:53 Tobias Schroeder [fbf21b]
strategy pattern is working with mitkImageVtkMapper2D
2012-02-03 10:13:19 Tobias Schroeder [50ac1c]
added new classes related to overwirte slices
2012-02-03 10:07:06 Tobias Schroeder [7b307a]
resloved merge conflicts