template<unsigned int VImageDimension>
void vvImageReader::UpdateWithDim(std::string InputPixelType)
{
- if (mType == VECTORFIELD)
+ if (mType == VECTORFIELD || mType == VECTORFIELDWITHTIME)
UpdateWithDimAndInputPixelType<itk::Vector<float,3>,VImageDimension>();
else if (InputPixelType == "short")
UpdateWithDimAndInputPixelType<short,VImageDimension>();
template<class InputPixelType, unsigned int VImageDimension>
void vvImageReader::UpdateWithDimAndInputPixelType()
{
- itk::AnalyzeImageIO *analyzeImageIO;
+ itk::AnalyzeImageIO *analyzeImageIO = NULL;
if (mType == MERGEDWITHTIME) // In this case we can load the images
// one at the time to avoid excessive
filter->SetExtractionRegion(extractedRegion);
filter->SetInput(reader->GetOutput());
filter->ReleaseDataFlagOn();
+#if ITK_VERSION_MAJOR == 4
+ filter->SetDirectionCollapseToSubmatrix();
+#endif
try {
mImage->AddItkImage<SlicedImageType>(filter->GetOutput());
} catch ( itk::ExceptionObject & err ) {
try {
if (mType == IMAGEWITHTIME)
- mImage=vvImageFromITK<VImageDimension,InputPixelType>(reader->GetOutput(),true);
+ {
+ std::cerr << "We should never come here:" << std::endl
+ << " Calling vvImageReader with multiple images and IMAGEWITHTIME is undefined." << std::endl
+ << " You are probably looking for MERGEDWITHTIME Type." << std::endl;
+ return;
+ }
else
mImage=vvImageFromITK<VImageDimension,InputPixelType>(reader->GetOutput());
} catch ( itk::ExceptionObject & err ) {
reader->ReleaseDataFlagOn();
try {
- if (mType == IMAGEWITHTIME)
+ if (mType == IMAGEWITHTIME || mType == VECTORFIELDWITHTIME)
mImage=vvImageFromITK<VImageDimension,InputPixelType>(reader->GetOutput(),true);
else
mImage=vvImageFromITK<VImageDimension,InputPixelType>(reader->GetOutput());
// For unknown analyze orientations, we set identity
if(analyzeImageIO) {
- const double m[16] = {1.,0.,0.,0.,0.,0.,1.,0.,0.,-1.,0.,0.,0.,0.,0.,1.};
+ const double m[16] = {1.,0.,0.,0.,
+ 0.,0.,1.,0.,
+ 0.,-1.,0.,0.,
+ 0.,0.,0.,1.};
int i;
- for(i=0; m[i]==mImage->GetTransform()->GetMatrix()->GetElement(i%4, i/4) && i<16; i++);
+ for(i=0; i<16 && m[i]==mImage->GetTransform()->GetMatrix()->GetElement(i%4, i/4); i++);
if(i==16) {
- itkWarningMacro(<< "Analyze image file format detected with unknown orientation."
+ itkWarningMacro(<< "Analyze image file format detected with unknown orientation. "
<< "Forcing identity orientation, use other file format if not ok.");
mImage->GetTransform()->Identity();
}