* Author: caceres
*/
-
#include "imageUndoRedo.h"
ImageUndoRedo::ImageUndoRedo(ImageType* current) {
}
//virtual
void ImageUndoRedo::undo() {
-
+ ImageInfoUR imageInfo = this->m_ImagesDeque->undo();
+ this->setRedoImage(imageInfo.getRegion());
+ this->drawUR(imageInfo);
}
//virtual
void ImageUndoRedo::redo() {
-
+ ImageInfoUR imageInfo = this->m_ImagesDeque->undo();
+ this->drawUR(imageInfo);
+ imageInfo.removeImageFromMemory();
}
//virtual
void ImageUndoRedo::setUndoImage(const RegionSType& region) {
-
+ vtkExtractVOI* extract;
+ extract->New();
+ extract->SetVOI(region.minX, region.maxX, region.minY, region.maxY,
+ region.minZ, region.maxZ);
+ extract->SetSampleRate(1, 1, 1);
+ extract->SetInput(this->m_OriginalImage);
+ this->m_ImagesDeque->addImageToUndoContainer(extract->GetOutput(), region);
+ extract->Delete();
}
//virtual
-void ImageUndoRedo::setRedoImage( const RegionSType& region ) {
-
+void ImageUndoRedo::setRedoImage(const RegionSType& region) {
+ vtkExtractVOI* extract;
+ extract->New();
+ extract->SetVOI(region.minX, region.maxX, region.minY, region.maxY,
+ region.minZ, region.maxZ);
+ extract->SetSampleRate(1, 1, 1);
+ extract->SetInput(this->m_CurrentImage);
+ this->m_ImagesDeque->addImageToUndoContainer(extract->GetOutput(), region);
+ extract->Delete();
}
void ImageUndoRedo::setOriginalImage(ImageType* img) {
this->m_OriginalImage = img;
this->m_CurrentImage = img;
}
//virtual
-void ImageUndoRedo::drawUR(ImageType* urImage, const RegionSType& region){
+void ImageUndoRedo::drawUR(ImageInfoUR imageInfo) {
}
#define IMAGEUNDOREDO_H_
#include "managerUR.h"
+#include <vtkExtractVOI.h>
class ImageUndoRedo: public ManagerUR {
virtual void undo();
virtual void redo();
virtual void setUndoImage(const RegionSType& region);
- virtual void setRedoImage( const RegionSType& region );
+ virtual void setRedoImage(const RegionSType& region);
void setOriginalImage(ImageType* img);
void setCurrentImage(ImageType* img);
private:
- virtual void drawUR(ImageType* urImage, const RegionSType& region);
+ virtual void drawUR(ImageInfoUR imageInfo);
};
#include <string>
#include <vtkImageData.h>
-#include "imageDequeUR.h"
+#include "image3DDequeUR.h"
-typedef ImageDequeUR IDequeType;
+typedef Image3DDequeUR IDequeType;
typedef RegionStructUR RegionSType;
typedef vtkImageData ImageType;
virtual ~ManagerUR();
virtual void undo();
virtual void redo();
- virtual void setUndoImage( const RegionSType& region );
- virtual void setRedoImage( const RegionSType& region );
+ virtual void setUndoImage(const RegionSType& region);
+ virtual void setRedoImage(const RegionSType& region);
private:
- virtual void drawUR(ImageType* urImage, const RegionSType& region);
+ virtual void drawUR(ImageInfoUR imageInfo);
};