Hi Pedro,

if you want to use the undo/redo mechanism then you will have to create 
appropriate operations. One for actually doing the stuff you want to do and one 
"negative" operation which exactly reverts the previous one. Examples of how to 
use the undo/redo in MITK can be found on many places in our source code. Most 
of the 2D segmentation tools are using the undo/redo although the support is 
somehow limited. E.g. the 3D interpolation currently does not react to 
undo/redo.
You can find an example in the mitkOverwriteSliceImageFilter line 123:

if ( m_CreateUndoInformation )
  {
    // create do/undo operations (we don't execute the doOp here, because it 
has already been executed during calculation of the diff image
    ApplyDiffImageOperation* doOp = new ApplyDiffImageOperation( OpTEST, 
const_cast<Image*>(input.GetPointer()), m_SliceDifferenceImage, m_TimeStep, 
m_SliceDimension, m_SliceIndex );
    ApplyDiffImageOperation* undoOp = new ApplyDiffImageOperation( OpTEST, 
const_cast<Image*>(input.GetPointer()), m_SliceDifferenceImage, m_TimeStep, 
m_SliceDimension, m_SliceIndex );
    undoOp->SetFactor( -1.0 );
    OperationEvent* undoStackItem = new OperationEvent( 
DiffImageApplier::GetInstanceForUndo(), doOp, undoOp, 
this->EventDescription(m_SliceDimension, m_SliceIndex, m_TimeStep) );
    UndoController::GetCurrentUndoModel()->SetOperationEvent( undoStackItem );
  }

In this case a difference image has to be created.

Best regards
Andreas

From: Pedro Cardoso [mailto:[email protected]]
Sent: Dienstag, 27. August 2013 22:05
To: [email protected]
Subject: [mitk-users] Undo Controller

Hi,

can someone explain me how can I use the mitkUndoController? I've looked into 
the Interaction and Undo/Redo Concepts 
(http://docs.mitk.org/nightly-qt4/InteractionPage.html), but I can't really 
understand how can I use the undo controller. Also, I'd like to know if the 
undo controller also works with the mitk tools


Thanks in advance.
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to