From 82b681684885a9db09ae5d43fa4681ae03544fae Mon Sep 17 00:00:00 2001 From: Frederic Cervenansky Date: Wed, 12 Oct 2011 15:27:03 +0000 Subject: [PATCH] bug on spacing --- src/creaImageIOGimmickView.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/creaImageIOGimmickView.cpp b/src/creaImageIOGimmickView.cpp index 5ad0525..76342d6 100644 --- a/src/creaImageIOGimmickView.cpp +++ b/src/creaImageIOGimmickView.cpp @@ -495,7 +495,10 @@ void GimmickView::ReadImagesNotThreaded(std::vector& 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& 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& 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& 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(); -- 2.47.1