]> Creatis software - creaImageIO.git/commitdiff
bug on spacing
authorFrederic Cervenansky <Frederic.Cervenansky@creatis.insa-lyon.fr>
Wed, 12 Oct 2011 15:27:03 +0000 (15:27 +0000)
committerFrederic Cervenansky <Frederic.Cervenansky@creatis.insa-lyon.fr>
Wed, 12 Oct 2011 15:27:03 +0000 (15:27 +0000)
src/creaImageIOGimmickView.cpp

index 5ad0525e5202c73c3960e59bb3f23a0042aa8bc3..76342d64da63897103dbdf17b01575d587b4341a 100644 (file)
@@ -495,7 +495,10 @@ void GimmickView::ReadImagesNotThreaded(std::vector<vtkImageData*>& s, std::vect
                }
                out.img->SetExtent(ext);
                int dim[3];
+               double spac[3];
                first->GetDimensions(dim);
+               first->GetSpacing(spac);
+               out.img->SetSpacing(spac);
                out.img->SetDimensions(dim[0], dim[1], im.size() );
                out.img->AllocateScalars();
                out.img->Update();
@@ -528,7 +531,9 @@ void GimmickView::ReadImagesNotThreaded(std::vector<vtkImageData*>& s, std::vect
        {
                vtkImageData* first = mReader.GetImage( im.front());
                int dim[3];
+               double spac[3];
                first->GetDimensions(dim);
+               first->GetSpacing(spac);
                // differents formats char , short, etc...
                // differents components 1..3  ex. jpg ->RGB 3
                unsigned long imsize = dim[0] * dim[1];
@@ -546,7 +551,7 @@ void GimmickView::ReadImagesNotThreaded(std::vector<vtkImageData*>& s, std::vect
                                OutStrGimmick out;
                                out.img = vtkImageData::New();
                                out.img->SetScalarType(first->GetScalarType());
-
+                               out.img->SetSpacing(spac);
                                out.img->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents());
                                int ext[6];
                                first->GetWholeExtent(ext);  // send also 0,0 in Z 
@@ -589,10 +594,12 @@ void GimmickView::ReadImagesNotThreaded(std::vector<vtkImageData*>& s, std::vect
                        out.img->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents());
                        
                        int ext[6];
+                       double spac[6];
                        first->GetWholeExtent(ext);  // send also 0,0 in Z 
                        ext[5] = 0;
                        out.img->SetExtent(ext);
-                       
+                       first->GetSpacing(spac);
+                       out.img->SetSpacing(spac);
                        out.img->SetDimensions(dim[0], dim[1], im.size() );
                        out.img->AllocateScalars();
                        out.img->Update();