X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FvvImageReader.txx;h=6a4333ff3c59c055c704117954747e7f656a133b;hb=80ddaed8a2022748b22a8d2bb85371e4502408db;hp=e15e6d7688ff4a6a202e8f9e62bd42d133128ca5;hpb=cc2f3e22307a2ddb835c4ae15dbe5302a143653f;p=clitk.git diff --git a/common/vvImageReader.txx b/common/vvImageReader.txx index e15e6d7..6a4333f 100644 --- a/common/vvImageReader.txx +++ b/common/vvImageReader.txx @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include @@ -36,7 +36,12 @@ template void vvImageReader::UpdateWithDim(std::string InputPixelType) { if (mType == VECTORFIELD || mType == VECTORFIELDWITHTIME) - UpdateWithDimAndInputVectorPixelType,VImageDimension>(); + { + if (VImageDimension == 4) + UpdateWithDimAndInputVectorPixelType,VImageDimension>(); + else + UpdateWithDimAndInputVectorPixelType,VImageDimension>(); + } else if (InputPixelType == "short") UpdateWithDimAndInputPixelType(); else if (InputPixelType == "unsigned_short") @@ -235,14 +240,15 @@ void vvImageReader::UpdateWithDimAndInputVectorPixelType() } analyzeImageIO = dynamic_cast( reader->GetImageIO() ); } - + typedef itk::Image< itk::Vector, VImageDimension > VectorImageType; - typedef itk::VectorCastImageFilter CasterType; + typedef itk::FlexibleVectorCastImageFilter CasterType; typename VectorImageType::Pointer casted_input; typename CasterType::Pointer caster = CasterType::New(); caster->SetInput(input); + caster->Update(); casted_input = caster->GetOutput(); - + mImage = vvImageFromITK >(casted_input, mType == IMAGEWITHTIME || mType == VECTORFIELDWITHTIME); // For unknown analyze orientations, we set identity