From: Simon Rit Date: Fri, 10 Aug 2012 14:46:15 +0000 (+0200) Subject: Manage a list of transform for image sequences X-Git-Tag: v1.4.0~281^2~23 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=bec6f659babc742382ca007b53800e7305fa298f;p=clitk.git Manage a list of transform for image sequences --- diff --git a/common/vvImage.cxx b/common/vvImage.cxx index 0bddb26..31c6ef0 100644 --- a/common/vvImage.cxx +++ b/common/vvImage.cxx @@ -32,7 +32,7 @@ #include //-------------------------------------------------------------------- -vvImage::vvImage():mTransform(vtkSmartPointer::New()) +vvImage::vvImage() { Init(); } @@ -251,7 +251,7 @@ bool vvImage::IsScalarTypeInteger(int t) //-------------------------------------------------------------------- //-------------------------------------------------------------------- -vtkSmartPointer vvImage::GetTransform() +const std::vector< vtkSmartPointer >& vvImage::GetTransform() { return this->mTransform; } diff --git a/common/vvImage.h b/common/vvImage.h index ec01a1f..a120457 100644 --- a/common/vvImage.h +++ b/common/vvImage.h @@ -56,7 +56,7 @@ public : bool IsTimeSequence() const; bool IsScalarTypeInteger(); bool IsScalarTypeInteger(int t); - vtkSmartPointer GetTransform(); + const std::vector< vtkSmartPointer >& GetTransform(); void SetTimeSpacing(double s) { mTimeSpacing = s; } void SetTimeOrigin(double o) { mTimeOrigin = o; } bool HaveSameSizeAndSpacingThan(vvImage * other); @@ -66,8 +66,8 @@ private: ~vvImage(); std::vector< ConverterPointer > mItkToVtkConverters; - std::vector mVtkImages; - vtkSmartPointer mTransform; + std::vector< vtkImageData* > mVtkImages; + std::vector< vtkSmartPointer > mTransform; double mTimeOrigin; double mTimeSpacing; diff --git a/common/vvImage.txx b/common/vvImage.txx index 14da10a..55b785f 100644 --- a/common/vvImage.txx +++ b/common/vvImage.txx @@ -50,7 +50,8 @@ void vvImage::AddItkImage(TItkImageType *input) // GetDirection provides the forward transform, vtkImageReslice wants the inverse matrix->Invert(); - mTransform->SetMatrix(matrix); + mTransform.push_back(vtkSmartPointer::New()); + mTransform.back()->SetMatrix(matrix); } //-------------------------------------------------------------------- diff --git a/common/vvImageReader.cxx b/common/vvImageReader.cxx index 0205355..c795cd9 100644 --- a/common/vvImageReader.cxx +++ b/common/vvImageReader.cxx @@ -110,37 +110,37 @@ void vvImageReader::SetInputFilenames(const std::vector & filenames //------------------------------------------------------------------------------ //Read transformation in NKI format (Xdr, transposed, cm) -void vvImageReader::ReadNkiImageTransform() -{ - bool bRead=false; - std::string filename = mInputFilenames[0]+".MACHINEORIENTATION"; - if(itksys::SystemTools::FileExists(filename.c_str())){ - typedef itk::ImageFileReader< itk::Image< double, 2 > > MatrixReaderType; - MatrixReaderType::Pointer readerTransfo = MatrixReaderType::New(); - readerTransfo->SetFileName(filename); - try { - bRead = true; - readerTransfo->Update(); - } catch( itk::ExceptionObject & err ) { - bRead=false; - std::cerr << "Cannot read " << filename << std::endl - << "The error is: " << err << std::endl; - } - - if (bRead) { - //Transpose matrix (NKI format) - for(int j=0; j<4; j++) - for(int i=0; i<4; i++) - mImage->GetTransform()->GetMatrix()->SetElement(j,i,readerTransfo->GetOutput()->GetBufferPointer()[4*i+j]); - - //From cm to mm - for(int i=0; i<3; i++) - mImage->GetTransform()->GetMatrix()->SetElement(i,3,10*mImage->GetTransform()->GetMatrix()->GetElement(i,3)); - - mImage->GetTransform()->Inverse(); - } - } -} +//void vvImageReader::ReadNkiImageTransform() +//{ +// bool bRead=false; +// std::string filename = mInputFilenames[0]+".MACHINEORIENTATION"; +// if(itksys::SystemTools::FileExists(filename.c_str())){ +// typedef itk::ImageFileReader< itk::Image< double, 2 > > MatrixReaderType; +// MatrixReaderType::Pointer readerTransfo = MatrixReaderType::New(); +// readerTransfo->SetFileName(filename); +// try { +// bRead = true; +// readerTransfo->Update(); +// } catch( itk::ExceptionObject & err ) { +// bRead=false; +// std::cerr << "Cannot read " << filename << std::endl +// << "The error is: " << err << std::endl; +// } + +// if (bRead) { +// //Transpose matrix (NKI format) +// for(int j=0; j<4; j++) +// for(int i=0; i<4; i++) +// mImage->GetTransform()->GetMatrix()->SetElement(j,i,readerTransfo->GetOutput()->GetBufferPointer()[4*i+j]); + +// //From cm to mm +// for(int i=0; i<3; i++) +// mImage->GetTransform()->GetMatrix()->SetElement(i,3,10*mImage->GetTransform()->GetMatrix()->GetElement(i,3)); + +// mImage->GetTransform()->Inverse(); +// } +// } +//} //------------------------------------------------------------------------------ @@ -192,9 +192,10 @@ void vvImageReader::ReadMatImageTransform() vtkGenericWarningMacro("Matrix in " << filename.c_str() << " cannot be inverted (determinant = 0)"); } - mImage->GetTransform()->PostMultiply(); - mImage->GetTransform()->Concatenate(matrix); - mImage->GetTransform()->Update(); + // TODO SR and BP: check on the list of transforms and not the first only + mImage->GetTransform()[0]->PostMultiply(); + mImage->GetTransform()[0]->Concatenate(matrix); + mImage->GetTransform()[0]->Update(); } } //------------------------------------------------------------------------------ diff --git a/common/vvImageReader.h b/common/vvImageReader.h index dae05e4..4348e0f 100644 --- a/common/vvImageReader.h +++ b/common/vvImageReader.h @@ -92,7 +92,7 @@ protected: std::string mInputPixelType; //==================================================================== - void ReadNkiImageTransform(); +// void ReadNkiImageTransform(); void ReadMatImageTransform(); private: vvImageReader(); diff --git a/common/vvImageReader.txx b/common/vvImageReader.txx index 6a4333f..9b0e21a 100644 --- a/common/vvImageReader.txx +++ b/common/vvImageReader.txx @@ -187,12 +187,13 @@ void vvImageReader::UpdateWithDimAndInputPixelType() 0.,0.,1.,0., 0.,-1.,0.,0., 0.,0.,0.,1.}; + // TODO SR and BP: check on the list of transforms and not the first only int i; - for(i=0; i<16 && m[i]==mImage->GetTransform()->GetMatrix()->GetElement(i%4, i/4); i++); + for(i=0; i<16 && m[i]==mImage->GetTransform()[0]->GetMatrix()->GetElement(i%4, i/4); i++); if(i==16) { itkWarningMacro(<< "Analyze image file format detected with unknown orientation. " << "Forcing identity orientation, use other file format if not ok."); - mImage->GetTransform()->Identity(); + mImage->GetTransform()[0]->Identity(); } } } @@ -259,13 +260,13 @@ void vvImageReader::UpdateWithDimAndInputVectorPixelType() 0.,-1.,0.,0., 0.,0.,0.,1.}; int i; - for (i = 0; i < 16 && m[i] == mImage->GetTransform()->GetMatrix()->GetElement(i % 4, i / 4); i++) + for (i = 0; i < 16 && m[i] == mImage->GetTransform()[0]->GetMatrix()->GetElement(i % 4, i / 4); i++) ; if (i == 16) { itkWarningMacro(<< "Analyze image file format detected with unknown orientation. " << "Forcing identity orientation, use other file format if not ok."); - mImage->GetTransform()->Identity(); + mImage->GetTransform()[0]->Identity(); } } } diff --git a/common/vvImageWriter.txx b/common/vvImageWriter.txx index 0640f0c..0705197 100644 --- a/common/vvImageWriter.txx +++ b/common/vvImageWriter.txx @@ -73,7 +73,8 @@ void vvImageWriter::UpdateWithDimAndOutputPixelType() itk::Matrix trans; for(int i=0; i<4; i++) for(int j=0; j<4; j++) - trans[i][j] = mImage->GetTransform()->GetMatrix()->GetElement(i,j); + // TODO SR and BP: check on the list of transforms and not the first only + trans[i][j] = mImage->GetTransform()[0]->GetMatrix()->GetElement(i,j); trans = trans.GetInverse(); // Direction diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index 38f4f8b..4e70cd4 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -952,6 +952,8 @@ void vvMainWindow::LoadImages(std::vector files, vvImageReader::Loa this,SLOT(UpdateSlice(int,int))); connect(mSlicerManagers.back(), SIGNAL(UpdateTSlice(int, int)), this,SLOT(UpdateTSlice(int, int))); + connect(mSlicerManagers.back(), SIGNAL(UpdateTSlice(int, int)), + this,SLOT(ImageInfoChanged())); connect(mSlicerManagers.back(), SIGNAL(UpdateSliceRange(int,int,int,int,int)), this,SLOT(UpdateSliceRange(int,int,int,int,int))); connect(mSlicerManagers.back(), SIGNAL(UpdateLinkManager(std::string,int,double,double,double,int)), @@ -1139,7 +1141,7 @@ void vvMainWindow::ImageInfoChanged() infoPanel->setOrigin(GetVectorDoubleAsString(origin)); infoPanel->setSpacing(GetVectorDoubleAsString(inputSpacing)); infoPanel->setNPixel(QString::number(NPixel)+" ("+inputSizeInBytes+")"); - transformation = imageSelected->GetTransform()->GetMatrix(); + transformation = imageSelected->GetTransform()[mSlicerManagers[index]->GetTSlice()]->GetMatrix(); infoPanel->setTransformation(Get4x4MatrixDoubleAsString(transformation)); landmarksPanel->SetCurrentLandmarks(mSlicerManagers[index]->GetLandmarks(), @@ -1727,7 +1729,7 @@ void vvMainWindow::UpdateSlicingPreset() { if (DataTree->selectedItems().size()) { int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); - mSlicerManagers[index]->SetSlicingPreset(slicingPresetComboBox->currentIndex()); + mSlicerManagers[index]->SetSlicingPreset(vvSlicerManager::SlicingPresetType(slicingPresetComboBox->currentIndex())); } } //------------------------------------------------------------------------------ @@ -2319,7 +2321,8 @@ void vvMainWindow::SaveAs() bool bId = true; for(int i=0; i<4; i++) for(int j=0; j<4; j++) { - double elt = mSlicerManagers[index]->GetImage()->GetTransform()->GetMatrix()->GetElement(i,j); + // TODO SR and BP: check on the list of transforms and not the first only + double elt = mSlicerManagers[index]->GetImage()->GetTransform()[0]->GetMatrix()->GetElement(i,j); if(i==j && elt!=1.) bId = false; if(i!=j && elt!=0.) @@ -3090,6 +3093,8 @@ vvSlicerManager* vvMainWindow::AddImage(vvImage::Pointer image,std::string filen this,SLOT(UpdateSlice(int,int))); connect(mSlicerManagers.back(), SIGNAL(UpdateTSlice(int, int)), this,SLOT(UpdateTSlice(int, int))); + connect(mSlicerManagers.back(), SIGNAL(UpdateTSlice(int, int)), + this,SLOT(ImageInfoChanged())); connect(mSlicerManagers.back(), SIGNAL(UpdateSliceRange(int,int,int,int,int)), this,SLOT(UpdateSliceRange(int,int,int,int,int))); connect(mSlicerManagers.back(), SIGNAL(UpdateLinkManager(std::string,int,double,double,double,int)), diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index 52fa161..2a5c924 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -326,7 +326,7 @@ void vvSlicer::SetImage(vvImage::Pointer image) } mConcatenatedTransform->Identity(); - mConcatenatedTransform->Concatenate(mImage->GetTransform()); + mConcatenatedTransform->Concatenate(mImage->GetTransform()[0]); mConcatenatedTransform->Concatenate(mSlicingTransform); mImageReslice->SetResliceTransform(mConcatenatedTransform); mImageReslice->SetInput(0, mImage->GetFirstVTKImageData()); @@ -369,7 +369,7 @@ void vvSlicer::SetOverlay(vvImage::Pointer overlay) mOverlayReslice->AutoCropOutputOn(); mOverlayReslice->SetBackgroundColor(-1000,-1000,-1000,1); } - mOverlayReslice->SetResliceTransform(mOverlay->GetTransform()); + mOverlayReslice->SetResliceTransform(mOverlay->GetTransform()[0]); mOverlayReslice->SetInput(0, mOverlay->GetFirstVTKImageData()); if (!mOverlayMapper) @@ -416,7 +416,7 @@ void vvSlicer::SetFusion(vvImage::Pointer fusion) mFusionReslice->AutoCropOutputOn(); mFusionReslice->SetBackgroundColor(-1000,-1000,-1000,1); } - mFusionReslice->SetResliceTransform(mFusion->GetTransform()); + mFusionReslice->SetResliceTransform(mFusion->GetTransform()[0]); mFusionReslice->SetInput(0, mFusion->GetFirstVTKImageData()); if (!mFusionMapper) @@ -698,6 +698,12 @@ void vvSlicer::SetTSlice(int t) else if ((unsigned int)t >= mImage->GetVTKImages().size()) t = mImage->GetVTKImages().size() -1; + // Update transform + mConcatenatedTransform->Identity(); + mConcatenatedTransform->Concatenate(mImage->GetTransform()[t]); + mConcatenatedTransform->Concatenate(mSlicingTransform); + + // Update image data mCurrentTSlice = t; mImageReslice->SetInput( mImage->GetVTKImages()[mCurrentTSlice] ); if (mVF && mVFActor->GetVisibility()) { diff --git a/vv/vvSlicerManager.cxx b/vv/vvSlicerManager.cxx index 1804970..b6f2156 100644 --- a/vv/vvSlicerManager.cxx +++ b/vv/vvSlicerManager.cxx @@ -72,7 +72,7 @@ vvSlicerManager::vvSlicerManager(int numberOfSlicers) mPreviousSlice.resize(numberOfSlicers); mPreviousTSlice.resize(numberOfSlicers); - mSlicingPreset = 0; + mSlicingPreset = WORLD_SLICING; } //---------------------------------------------------------------------------- @@ -427,6 +427,13 @@ void vvSlicerManager::SetSliceOrientation(int slicer, int orientation) } //---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +int vvSlicerManager::GetTSlice() +{ + return mSlicers[0]->GetTSlice(); +} +//---------------------------------------------------------------------------- + //---------------------------------------------------------------------------- void vvSlicerManager::SetTSlice(int slice) { @@ -439,7 +446,7 @@ void vvSlicerManager::SetTSlice(int slice) for ( unsigned int i = 0; i < mSlicers.size(); i++) { if (slice != mSlicers[i]->GetTSlice()) { mSlicers[i]->SetTSlice(slice); - UpdateTSlice(i); + UpdateTSlice(i); } } } @@ -499,6 +506,13 @@ void vvSlicerManager::SetTSliceInSlicer(int tslice, int slicer) if (mSlicers[slicer]->GetTSlice() == tslice) return; + if(mSlicingPreset==VOXELS_SLICING) { + vtkMatrix4x4 *imageTransformInverse = vtkMatrix4x4::New(); + mImage->GetTransform()[tslice]->GetInverse(imageTransformInverse); + this->GetSlicer(slicer)->GetSlicingTransform()->SetMatrix(imageTransformInverse); + imageTransformInverse->Delete(); + } + mSlicers[slicer]->SetTSlice(tslice); UpdateTSlice(slicer); } @@ -808,13 +822,17 @@ bool vvSlicerManager::GetLinkOverlayWindowLevel() const void vvSlicerManager::ResetTransformationToIdentity(const std::string actorType) { if(actorType == "image") - this->GetImage()->GetTransform()->Identity(); + for(unsigned int i=0; iGetImage()->GetTransform().size(); i++) + this->GetImage()->GetTransform()[i]->Identity(); else if(actorType == "overlay") - this->GetSlicer(0)->GetOverlay()->GetTransform()->Identity(); + for(unsigned int i=0; iGetImage()->GetTransform().size(); i++) + this->GetSlicer(0)->GetOverlay()->GetTransform()[i]->Identity(); else if(actorType == "fusion") - this->GetSlicer(0)->GetFusion()->GetTransform()->Identity(); + for(unsigned int i=0; iGetImage()->GetTransform().size(); i++) + this->GetSlicer(0)->GetFusion()->GetTransform()[i]->Identity(); else if(actorType == "vf") - this->GetVF()->GetTransform()->Identity(); + for(unsigned int i=0; iGetImage()->GetTransform().size(); i++) + this->GetVF()->GetTransform()[i]->Identity(); else return; @@ -1072,25 +1090,25 @@ void vvSlicerManager::UpdateSliceRange(int slicer) //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- -void vvSlicerManager::SetSlicingPreset(int preset) +void vvSlicerManager::SetSlicingPreset(SlicingPresetType preset) { if(mSlicingPreset==preset) return; - vtkMatrix4x4 *mImageTransformInverse = vtkMatrix4x4::New(); - mImage->GetTransform()->GetInverse(mImageTransformInverse); + vtkMatrix4x4 *imageTransformInverse = vtkMatrix4x4::New(); + mImage->GetTransform()[this->GetTSlice()]->GetInverse(imageTransformInverse); for(int i=0; i< this->GetNumberOfSlicers(); i++){ switch(preset) { - case 0: // World + case WORLD_SLICING: this->GetSlicer(i)->GetSlicingTransform()->Identity(); break; - case 1: // Voxels - this->GetSlicer(i)->GetSlicingTransform()->SetMatrix(mImageTransformInverse); + case VOXELS_SLICING: + this->GetSlicer(i)->GetSlicingTransform()->SetMatrix(imageTransformInverse); break; default: - mImageTransformInverse->Delete(); + imageTransformInverse->Delete(); return; } this->GetSlicer(i)->ForceUpdateDisplayExtent(); @@ -1098,7 +1116,7 @@ void vvSlicerManager::SetSlicingPreset(int preset) this->GetSlicer(i)->Render(); } - mImageTransformInverse->Delete(); + imageTransformInverse->Delete(); mSlicingPreset = preset; } @@ -1162,11 +1180,11 @@ void vvSlicerManager::SetPreset(int preset) void vvSlicerManager::SetLocalColorWindowing(const int slicer, const bool bCtrlKey) { double min, max; - int t = this->mSlicers[slicer]->GetTSlice(); + int t = this->GetTSlice(); if(bCtrlKey && this->mSlicers[slicer]->GetFusion()) { this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max, this->mSlicers[slicer]->GetFusion()->GetVTKImages()[t], - this->mSlicers[slicer]->GetFusion()->GetTransform()); + this->mSlicers[slicer]->GetFusion()->GetTransform()[t]); this->SetFusionWindow(max-min); this->SetFusionLevel(0.5*(min+max)); this->SetColorMap(mColorMap); @@ -1174,7 +1192,7 @@ void vvSlicerManager::SetLocalColorWindowing(const int slicer, const bool bCtrlK else if(bCtrlKey && this->mSlicers[slicer]->GetOverlay()) { this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max, this->mSlicers[slicer]->GetOverlay()->GetVTKImages()[t], - this->mSlicers[slicer]->GetOverlay()->GetTransform()); + this->mSlicers[slicer]->GetOverlay()->GetTransform()[t]); if(this->mSlicers[slicer]->GetLinkOverlayWindowLevel()){ this->SetColorWindow(max-min); this->SetColorLevel(0.5*(min+max)); diff --git a/vv/vvSlicerManager.h b/vv/vvSlicerManager.h index b469277..50a31ba 100644 --- a/vv/vvSlicerManager.h +++ b/vv/vvSlicerManager.h @@ -52,6 +52,7 @@ class vvSlicerManager : public QObject { Q_OBJECT public: + typedef enum {WORLD_SLICING, VOXELS_SLICING} SlicingPresetType; vvSlicerManager(int numberOfSlicers); ~vvSlicerManager(); @@ -103,6 +104,7 @@ class vvSlicerManager : public QObject { void SetFilename(std::string f, int number=0); void SetSliceOrientation(int slicer, int orientation); + int GetTSlice(); void SetTSlice(int slice); void SetNextTSlice(int originating_slicer); void SetPreviousTSlice(int originating_slicer); @@ -151,7 +153,7 @@ class vvSlicerManager : public QObject { int GetPreset() { return mPreset; } - int GetSlicingPreset() { + SlicingPresetType GetSlicingPreset() { return mSlicingPreset; } int GetOverlayColor() const { @@ -206,7 +208,7 @@ class vvSlicerManager : public QObject { void UpdateSlice(int slicer); void UpdateTSlice(int slicer); void UpdateSliceRange(int slicer); - void SetSlicingPreset(int preset); + void SetSlicingPreset(SlicingPresetType preset); vvLandmarks *GetLandmarks(); void AddLandmark(float x,float y,float z,float t); @@ -255,7 +257,7 @@ protected: bool mFusionShowLegend; int mPreset; - int mSlicingPreset; + SlicingPresetType mSlicingPreset; vvImageReader::LoadedImageType mType; std::string mVFComponent; std::string mOverlayComponent; diff --git a/vv/vvToolRigidReg.cxx b/vv/vvToolRigidReg.cxx index 28591ba..508551d 100644 --- a/vv/vvToolRigidReg.cxx +++ b/vv/vvToolRigidReg.cxx @@ -118,7 +118,8 @@ void vvToolRigidReg::InputIsSelected(vvSlicerManager *input) //backup original matrix for(int j=0; j<4; j++) for(int i=0; i<4; i++) - mInitialMatrix->SetElement(i,j, mCurrentSlicerManager->GetImage()->GetTransform()->GetMatrix()->GetElement(i,j)); + // TODO SR and BP: check on the list of transforms and not the first only + mInitialMatrix->SetElement(i,j, mCurrentSlicerManager->GetImage()->GetTransform()[0]->GetMatrix()->GetElement(i,j)); QString origTransformString = dynamic_cast(mMainWindow)->Get4x4MatrixDoubleAsString(mInitialMatrix); transformationLabel->setText(origTransformString); SetTransform(mInitialMatrix); @@ -242,7 +243,8 @@ void vvToolRigidReg::SpinBoxChange(double newVal) } // Compute transform and set - vtkSmartPointer transform_final=mInput->GetImage()->GetTransform(); + // TODO SR and BP: check on the list of transforms and not the first only + vtkSmartPointer transform_final=mInput->GetImage()->GetTransform()[0]; transform_final->Identity(); transform_final->PostMultiply(); @@ -294,7 +296,8 @@ void vvToolRigidReg::SaveFile() QFile file(filename); if (file.open(QFile::WriteOnly | QFile::Truncate)) { - vtkMatrix4x4* matrix = mCurrentSlicerManager->GetImage()->GetTransform()->GetMatrix(); + // TODO SR and BP: check on the list of transforms and not the first only + vtkMatrix4x4* matrix = mCurrentSlicerManager->GetImage()->GetTransform()[0]->GetMatrix(); QString matrixStr = dynamic_cast(mMainWindow)->Get4x4MatrixDoubleAsString(matrix,16); QTextStream out(&file); out << matrixStr; @@ -332,7 +335,8 @@ void vvToolRigidReg::LoadFile() //------------------------------------------------------------------------------ void vvToolRigidReg::ChangeOfRotationCenter() { - SetTransform(mCurrentSlicerManager->GetImage()->GetTransform()->GetMatrix()); + // TODO SR and BP: check on the list of transforms and not the first only + SetTransform(mCurrentSlicerManager->GetImage()->GetTransform()[0]->GetMatrix()); } //------------------------------------------------------------------------------ @@ -347,7 +351,8 @@ void vvToolRigidReg::ResetTransform() void vvToolRigidReg::SetTransform(vtkMatrix4x4 *matrix) { vtkSmartPointer transform=vtkSmartPointer::New(); - mCurrentSlicerManager->GetImage()->GetTransform()->SetMatrix(matrix); + // TODO SR and BP: check on the list of transforms and not the first only + mCurrentSlicerManager->GetImage()->GetTransform()[0]->SetMatrix(matrix); transform->Update(); Render(); dynamic_cast(mMainWindow)->ImageInfoChanged();