Skip to content
Snippets Groups Projects
Commit f45c930e authored by Julien Michel's avatar Julien Michel
Browse files

BUG: Avoid a cast that can fail if ImageBase* does not downcast to OutputImageType*

parent 61c5ef81
No related branches found
No related tags found
No related merge requests found
......@@ -117,21 +117,13 @@ void
OGRDataSourceToLabelImageFilter<TOutputImage>
::SetOutputParametersFromImage(const ImageBaseType * image)
{
if (dynamic_cast<const OutputImageType*>(image))
{
const OutputImageType * src = dynamic_cast<const OutputImageType*>(image);
this->SetOutputOrigin ( src->GetOrigin() );
this->SetOutputSpacing ( src->GetSpacing() );
//this->SetOutputStartIndex ( src->GetLargestPossibleRegion().GetIndex() );
this->SetOutputSize ( src->GetLargestPossibleRegion().GetSize() );
this->SetOutputProjectionRef(src->GetProjectionRef());
//this->SetOutputKeywordList(src->GetImageKeywordlist());
}
else
{
itkExceptionMacro(<< "Image can't be casted to output image type.");
}
this->SetOutputOrigin ( image->GetOrigin() );
this->SetOutputSpacing ( image->GetSpacing() );
this->SetOutputSize ( image->GetLargestPossibleRegion().GetSize() );
ImageMetadataInterfaceBase::Pointer imi = ImageMetadataInterfaceFactory::CreateIMI(image->GetMetaDataDictionary());
this->SetOutputProjectionRef(imi->GetProjectionRef());
}
template< class TOutputImage>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment