X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=src%2FcreaImageIOGimmickView.cpp;h=62c7d0c862fbb884d5ec6fcb4f03d47f46489361;hb=b124b45664473a3ad32c1c8cf680cc3355e4dbd2;hp=4ada3a9c54277a33230e0bee464de9bc514f3f3f;hpb=bebe9cec5af89cf1461b3230c9aa31e930d49fb8;p=creaImageIO.git diff --git a/src/creaImageIOGimmickView.cpp b/src/creaImageIOGimmickView.cpp index 4ada3a9..62c7d0c 100644 --- a/src/creaImageIOGimmickView.cpp +++ b/src/creaImageIOGimmickView.cpp @@ -36,8 +36,11 @@ #include #include #include + #endif +#include + /*#if defined(USE_GDCM2) #include #include "gdcmSystem.h" @@ -140,6 +143,7 @@ namespace creaImageIO /// Finalize void GimmickView::Finalize() { + printf("EED GimmickView::Finalize \n"); } //====================================================================== @@ -376,11 +380,14 @@ void GimmickView::ReadImagesNotThreaded(std::vector& s, std::vect // n*2D to 3D vtkImageData* out = vtkImageData::New(); // out->CopyStructure(first); - out->SetScalarType(first->GetScalarType()); - out->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents()); int ext[6]; //first->GetExtent(ext); // JPR +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 first->GetWholeExtent(ext); // renvoie egalement 0,0 en Z // JPR +#else + first->GetExtent(ext); // renvoie egalement 0,0 en Z // JPR +#endif if(ext[5] == 0) { @@ -396,10 +403,17 @@ void GimmickView::ReadImagesNotThreaded(std::vector& s, std::vect int dim[3]; first->GetDimensions(dim); - out->SetDimensions(dim[0], dim[1], (int)im.size() ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + out->SetScalarType(first->GetScalarType()); + out->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents()); out->AllocateScalars(); out->Update(); +#else + out->AllocateScalars(first->GetScalarType(),first->GetNumberOfScalarComponents()); +#endif unsigned long imsize = dim[0] * dim[1]; imsize = imsize * dim[2] ; // deal with multiframes // JPR @@ -486,29 +500,16 @@ void GimmickView::ReadImagesNotThreaded(std::vector& s, std::vect void GimmickView::readImages1(std::vector& o_output, std::vector im, OutputAttr i_attr) { - i_attr.outside.push_back("D0019_100a"); // simens Number Of Images In Mosaic - -//EED Borrame - int i,isize=i_attr.outside.size(); - for (i=0;i::iterator it; for (it=im.begin(); it!=im.end(); ++it) { OutStrGimmick out; - out.img = vtkImageData::New(); + out.img = vtkImageData::New(); out.img->ShallowCopy(mReader.GetImage(*it)); -printf("EED GimmickView::readImages1 A\n "); - if(i_attr.mult) + if(i_attr.mult) { getAttributes((*it),out.infos,i_attr); -printf("EED GimmickView::readImages1 B %s \n ", out.infos.find("D0019_100a")->second.c_str() ); } o_output.push_back(out); } @@ -516,7 +517,6 @@ printf("EED GimmickView::readImages1 B %s \n ", out.infos.find("D0019_100a")-> if(!i_attr.mult) { getAttributes(im.front(), o_output.front().infos, i_attr); -printf("EED GimmickView::readImages1 C %s \n ", o_output.front().infos.find("D0019_100a")->second.c_str() ); } } @@ -528,12 +528,16 @@ printf("EED GimmickView::readImages1 C %s \n ", o_output.front().infos.find("D OutputAttr i_attr, double i_zspc) { OutStrGimmick out; - vtkImageData* first = mReader.GetImage( im.front()); - out.img = vtkImageData::New(); - out.img->SetScalarType(first->GetScalarType()); - out.img->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents()); + vtkImageData* first = mReader.GetImage( im.front() ); + out.img = vtkImageData::New(); + int ext[6]; +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 first->GetWholeExtent(ext); // send also 0,0 in Z +#else + first->GetExtent(ext); // send also 0,0 in Z +#endif if(ext[5] == 0) { ext[5] = (int)im.size()-1; @@ -545,10 +549,25 @@ printf("EED GimmickView::readImages1 C %s \n ", o_output.front().infos.find("D double spac[3]; first->GetDimensions(dim); first->GetSpacing(spac); - out.img->SetSpacing(spac); + + //EED 2024-01-24 + spac[2] = i_zspc; + + out.img->SetSpacing(spac); out.img->SetDimensions(dim[0], dim[1], (int)im.size() ); + + + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + out.img->SetScalarType(first->GetScalarType()); + out.img->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents()); out.img->AllocateScalars(); out.img->Update(); +#else + out.img->AllocateScalars(first->GetScalarType(), first->GetNumberOfScalarComponents()); +#endif + unsigned long imsize = dim[0] * dim[1]; imsize = imsize * dim[2] ; // deal with multiframes here // differents formats char , short, etc... @@ -558,12 +577,14 @@ printf("EED GimmickView::readImages1 C %s \n ", o_output.front().infos.find("D //!!!!out.img->SetSpacing(i_zspc); int slice = 0; std::vector::iterator it; + for (it=im.begin(); it!=im.end(); ++it) { vtkImageData* cur = mReader.GetImage( (*it) ); memcpy(out.img->GetScalarPointer(0,0,slice), cur->GetScalarPointer(0,0,0), imsize); slice++; - } + } // for it + getAttributes(im.front(),out.infos, i_attr); o_output.push_back(out); } @@ -596,18 +617,30 @@ printf("EED GimmickView::readImages1 C %s \n ", o_output.front().infos.find("D for (int slice= 0 ; slice SetScalarType(first->GetScalarType()); + out.img = vtkImageData::New(); out.img->SetSpacing(spac); - out.img->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents()); int ext[6]; +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 first->GetWholeExtent(ext); // send also 0,0 in Z +#else + first->GetExtent(ext); // send also 0,0 in Z +#endif ext[5] = 0; out.img->SetExtent(ext); - out.img->SetDimensions(dim[0], dim[1], 1 ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + out.img->SetScalarType(first->GetScalarType()); + out.img->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents()); out.img->AllocateScalars(); out.img->Update(); +#else + out.img->AllocateScalars(first->GetScalarType(),first->GetNumberOfScalarComponents()); +#endif + + memcpy(out.img->GetScalarPointer(0,0,0), cur->GetScalarPointer(0,0,slice), imsize); o_output.push_back(out); } @@ -637,19 +670,33 @@ printf("EED GimmickView::readImages1 C %s \n ", o_output.front().infos.find("D { OutStrGimmick out; out.img = vtkImageData::New(); - out.img->SetScalarType(first->GetScalarType()); - out.img->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents()); int ext[6]; - double spac[6]; + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 first->GetWholeExtent(ext); // send also 0,0 in Z +#else + first->GetExtent(ext); // send also 0,0 in Z +#endif + + double spac[6]; ext[5] = 0; out.img->SetExtent(ext); first->GetSpacing(spac); out.img->SetSpacing(spac); out.img->SetDimensions(dim[0], dim[1], (int)im.size() ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + out.img->SetScalarType(first->GetScalarType()); + out.img->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents()); out.img->AllocateScalars(); out.img->Update(); +#else + out.img->AllocateScalars(first->GetScalarType(), first->GetNumberOfScalarComponents()); +#endif + unsigned long imsize = dim[0] * dim[1]; imsize = imsize * first->GetScalarSize() * first->GetNumberOfScalarComponents(); int index = 0; @@ -725,7 +772,6 @@ printf("EED GimmickView::readImages1 C %s \n ", o_output.front().infos.find("D //EED UnMosaic step... //How to verifie if is a mosaic file , with how many images inside?? - }