- for (int i = imageInfo->GetRegion().minX, x = 0;
- i <= imageInfo->GetRegion().maxX; i++, x++) {
- for (int j = imageInfo->GetRegion().minY, y = 0;
- j <= imageInfo->GetRegion().maxY; j++, y++) {
- for (int k = imageInfo->GetRegion().minZ, z = 0;
- k <= imageInfo->GetRegion().maxZ; k++, z++) {
- float value = img->GetScalarComponentAsFloat(i, j, k, 0);
- this->m_CurrentImage->SetScalarComponentFromFloat(i, j, k, 0,
- value);
- } //rof
- } //rof
- } //rof
- this->m_CurrentImage->Modified();
- }
+ img = imageInfo->GetUndoImage( );
+ } else {
+ img = imageInfo->GetRedoImage( );
+ } //else
+ RegionSType region = imageInfo->GetImageMManager()->GetModifiedRegion();
+ m_RestorBaseInitialPointX = imageInfo->GetImageMManager()->GetBaseInitialPointX();
+ m_RestorBaseInitialPointY = imageInfo->GetImageMManager()->GetBaseInitialPointY();
+ m_RestorBaseInitialPointZ = imageInfo->GetImageMManager()->GetBaseInitialPointZ();
+
+ if( img != NULL)
+ {
+ int *dim = img->GetDimensions( );
+ int sizeXImageIn = dim[ 0 ];
+ size_t linesize = sizeXImageIn * sizeof(unsigned short);
+ for( int j = region.minY, y = 0; j <= region.maxY; j++, y++ )
+ {
+ for( int k = region.minZ, z = 0; k <= region.maxZ; k++, z++ )
+ {
+ void* ptrsrc = img->GetScalarPointer( 0, y, z );
+ void* ptrdest = this->m_CurrentImage->GetScalarPointer( region.minX, j, k );
+ memcpy( ptrdest, ptrsrc, linesize );
+ } // for k
+ } // for j
+ this->m_CurrentImage->Modified( );
+ } // if img
+ this->m_ImagesDeque->ManageMemory( );
+}
+// ----------------------------------------------------------------------------------
+
+int ImageUndoRedo::GetRestorBaseInitialPointX()
+{
+ return m_RestorBaseInitialPointX;
+}
+
+int ImageUndoRedo::GetRestorBaseInitialPointY()
+{
+ return m_RestorBaseInitialPointY;
+}
+
+int ImageUndoRedo::GetRestorBaseInitialPointZ()
+{
+ return m_RestorBaseInitialPointZ;