+ analyzeImageIO = dynamic_cast<itk::AnalyzeImageIO*>( reader->GetImageIO() );
+ }
+ }
+
+ // 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.};
+ int 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. "
+ << "Forcing identity orientation, use other file format if not ok.");
+ mImage->GetTransform()->Identity();