diff --git a/Code/IO/otbExtendedFilenameToWriterOptions.cxx b/Code/IO/otbExtendedFilenameToWriterOptions.cxx index 7f2d9a743e38b705b07b18266a8b29489840a928..eafd3d9edae7b3169bb58cd69ddecbc550dd93c0 100644 --- a/Code/IO/otbExtendedFilenameToWriterOptions.cxx +++ b/Code/IO/otbExtendedFilenameToWriterOptions.cxx @@ -256,33 +256,11 @@ ExtendedFilenameToWriterOptions return m_Options.box.first; } -ExtendedFilenameToWriterOptions::RegionType +std::string ExtendedFilenameToWriterOptions ::GetBox() const { - typedef boost::tokenizer<boost::char_separator<char> > Tokenizer; - - boost::char_separator<char> sep(":"); - Tokenizer tokens(m_Options.box.second, sep); - - Tokenizer::iterator it = tokens.begin(); - RegionType::IndexType start; - RegionType::SizeType size; - - start[0] = atoi(it->c_str()); // first index on X - ++it; - start[1] = atoi(it->c_str()); // first index on Y - ++it; - size[0] = atoi(it->c_str()); // size along X - ++it; - size[1] = atoi(it->c_str()); // size along Y - - RegionType inputRegion; - - inputRegion.SetSize(size); - inputRegion.SetIndex(start); - - return inputRegion; + return m_Options.box.second; } diff --git a/Code/IO/otbExtendedFilenameToWriterOptions.h b/Code/IO/otbExtendedFilenameToWriterOptions.h index a02e3122b09c021a8b17a75708c14cb1dd19e7e5..3b26077217bf056503741ddfdaf37e412dc66e75 100644 --- a/Code/IO/otbExtendedFilenameToWriterOptions.h +++ b/Code/IO/otbExtendedFilenameToWriterOptions.h @@ -88,7 +88,7 @@ public: double GetStreamingSizeValue() const; bool BoxIsSet() const; - RegionType GetBox() const; + std::string GetBox() const; protected: diff --git a/Code/IO/otbImageFileWriter.txx b/Code/IO/otbImageFileWriter.txx index 300ce99e510b6260a100caf62e69dc2f5566f95b..012b32bf545e18339aa8bec59f239265b8238560 100644 --- a/Code/IO/otbImageFileWriter.txx +++ b/Code/IO/otbImageFileWriter.txx @@ -43,6 +43,9 @@ #include "otbRAMDrivenTiledStreamingManager.h" #include "otbRAMDrivenAdaptativeStreamingManager.h" +#include <boost/foreach.hpp> +#include <boost/tokenizer.hpp> + namespace otb { @@ -473,7 +476,26 @@ ImageFileWriter<TInputImage> /** Parse region size modes */ if(m_FilenameHelper->BoxIsSet()) { - inputRegion = m_FilenameHelper->GetBox(); + typedef boost::tokenizer<boost::char_separator<char> > Tokenizer; + + boost::char_separator<char> sep(":"); + Tokenizer tokens(m_FilenameHelper->GetBox(), sep); + + Tokenizer::iterator it = tokens.begin(); + typename InputImageRegionType::IndexType start; + typename InputImageRegionType::SizeType size; + + start[0] = atoi(it->c_str()); // first index on X + ++it; + start[1] = atoi(it->c_str()); // first index on Y + ++it; + size[0] = atoi(it->c_str()); // size along X + ++it; + size[1] = atoi(it->c_str()); // size along Y + + inputRegion.SetSize(size); + inputRegion.SetIndex(start) + otbMsgDevMacro(<< "inputRegion " << inputRegion); if (!inputRegion.Crop(inputPtr->GetLargestPossibleRegion()))