Skip to content
Snippets Groups Projects
Commit 3fb74afa authored by Manuel Grizonnet's avatar Manuel Grizonnet
Browse files

COMP: extendedFilenameHelper can not return ImageRegion of dimension 2 in all cases

parent 560531fe
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
......@@ -88,7 +88,7 @@ public:
double GetStreamingSizeValue() const;
bool BoxIsSet() const;
RegionType GetBox() const;
std::string GetBox() const;
protected:
......
......@@ -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()))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment