Commit d01b5f04 authored by Cédric Traizet's avatar Cédric Traizet
Browse files

REFAC: use ImageMetadata instead of itk dictionary to manage tileHint

parent 5a111713
Pipeline #8919 failed with stages
in 86 minutes and 23 seconds
......@@ -47,14 +47,23 @@ void RAMDrivenAdaptativeStreamingManager<TImage>::PrepareStreaming(itk::DataObje
typename otb::ImageRegionAdaptativeSplitter<itkGetStaticConstMacro(ImageDimension)>::SizeType tileHint;
unsigned int tileHintX(0), tileHintY(0);
itk::ExposeMetaData<unsigned int>(input->GetMetaDataDictionary(), MetaDataKey::TileHintX, tileHintX);
itk::ExposeMetaData<unsigned int>(input->GetMetaDataDictionary(), MetaDataKey::TileHintY, tileHintY);
tileHint[0] = tileHintX;
tileHint[1] = tileHintY;
auto inputImage = dynamic_cast<TImage*>(input);
tileHint[0] = 0;
tileHint[1] = 0;
if (inputImage)
{
const auto & imd = inputImage->GetImageMetadata();
if (imd.Has(MDNum::TileHintX))
{
tileHint[0] = imd[MDNum::TileHintX];
}
if (imd.Has(MDNum::TileHintY))
{
tileHint[1] = imd[MDNum::TileHintY];
}
}
typename otb::ImageRegionAdaptativeSplitter<itkGetStaticConstMacro(ImageDimension)>::Pointer splitter =
otb::ImageRegionAdaptativeSplitter<itkGetStaticConstMacro(ImageDimension)>::New();
......
......@@ -44,10 +44,9 @@ ImageType::Pointer makeImage(ImageType::RegionType region)
image->SetRegions(region);
image->SetNumberOfComponentsPerPixel(10);
itk::MetaDataDictionary& dict = image->GetMetaDataDictionary();
itk::EncapsulateMetaData<unsigned int>(dict, otb::MetaDataKey::TileHintX, 64);
itk::EncapsulateMetaData<unsigned int>(dict, otb::MetaDataKey::TileHintY, 64);
auto & imd = image->GetImageMetadata();
imd.Add(otb::MDNum::TileHintX, 64);
imd.Add(otb::MDNum::TileHintY, 64);
return image;
}
......
......@@ -700,9 +700,6 @@ void GDALImageIO::InternalReadImageInformation()
blockSizeY = blockSizeY * (1 << m_ResolutionFactor);
}
itk::EncapsulateMetaData<unsigned int>(dict, MetaDataKey::TileHintX, blockSizeX);
itk::EncapsulateMetaData<unsigned int>(dict, MetaDataKey::TileHintY, blockSizeY);
m_Imd.NumericKeys[MDNum::TileHintX] = blockSizeX;
m_Imd.NumericKeys[MDNum::TileHintY] = blockSizeY;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment