Commit 2e731239 authored by saubatn's avatar saubatn
Browse files

FEATURE 609 Add ImageComponent::PostSaving() method which revert changes done...

FEATURE 609 Add ImageComponent::PostSaving() method which revert changes done to image data for saving it.

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@1964 ec899d31-69d1-42ba-9299-647d76f65fb3
parent 9383ecc3
......@@ -149,11 +149,11 @@ Application::Application(QString name, int & theArgc, char ** theArgv, bool auto
Application::~Application() {
// do not use the destructor to clean or free resources, but quitting()
if (translator)
{
//delete instance of internationalization support
delete translator;
}
if (translator)
{
//delete instance of internationalization support
delete translator;
}
}
......@@ -505,11 +505,16 @@ bool Application::save(Component* component) {
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
if(ImageComponent* imgComp = dynamic_cast<ImageComponent*>(component)) {
// If we deal with an ImageComponent, we apply the frame transform to the image data, to save it
// If we deal with an ImageComponent, prepare it for saving
imgComp->prepareForSaving();
}
if (cp->save(component)) {
if(ImageComponent* imgComp = dynamic_cast<ImageComponent*>(component)) {
// If we deal with an ImageComponent, revert changes made for saving it
imgComp->postSaving();
}
// update the last used dir
setLastUsedDirectory(QFileInfo(component->getFileName()).absoluteDir());
showStatusBarMessage( component->getName() + tr ( " successfully saved..." ));
......
......@@ -358,6 +358,17 @@ void ImageComponent::prepareForSaving() {
}
}
// -------------------- postSaving --------------------
void ImageComponent::postSaving(){
// Revert changes made on image data
vtkSmartPointer<vtkImageReslice> revertImageDataFilter = vtkSmartPointer<vtkImageReslice>::New();
revertImageDataFilter->SetInput(originalImageData);
revertImageDataFilter->SetOutputDimensionality(3);
revertImageDataFilter->SetResliceAxes(initialImageDataTransform->GetMatrix());
originalImageData = revertImageDataFilter->GetOutput();
originalImageData->Update();
}
// -------------------- initLookupTable --------------------
void ImageComponent::initLookupTable() {
......
......@@ -113,6 +113,11 @@ public:
/// Also, the frame modification on the image are saved
void prepareForSaving();
/// Revert all changes made to the image (data and its frame) to save it correctly
/// This allows to correctly manipulate the image again.
void postSaving();
/** Method called when a pixel has been picked in the 3D view.
* This method tells all the scene3D to display the slice containing the picked pixel.
* The arguments are the ccordinates of the 3D point.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment