X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FcreaImageIOGimmickView.cpp;fp=src%2FcreaImageIOGimmickView.cpp;h=c9965637106f259cf1e00d943f5508248b711077;hb=688c28613d4d3f54fb74d55adb653a4a26cebf13;hp=4ada3a9c54277a33230e0bee464de9bc514f3f3f;hpb=56e12662d134e9c80989719e6295d7c913cf7af0;p=creaImageIO.git diff --git a/src/creaImageIOGimmickView.cpp b/src/creaImageIOGimmickView.cpp index 4ada3a9..c996563 100644 --- a/src/creaImageIOGimmickView.cpp +++ b/src/creaImageIOGimmickView.cpp @@ -376,11 +376,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 +399,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 @@ -530,10 +540,13 @@ printf("EED GimmickView::readImages1 C %s \n ", o_output.front().infos.find("D OutStrGimmick out; vtkImageData* first = mReader.GetImage( im.front()); out.img = vtkImageData::New(); - out.img->SetScalarType(first->GetScalarType()); - 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 if(ext[5] == 0) { ext[5] = (int)im.size()-1; @@ -547,8 +560,20 @@ printf("EED GimmickView::readImages1 C %s \n ", o_output.front().infos.find("D 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 * dim[2] ; // deal with multiframes here // differents formats char , short, etc... @@ -597,17 +622,29 @@ 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->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 +674,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;