From e288efd7f41a02aa2a18c0a92f9d0ac08624ef21 Mon Sep 17 00:00:00 2001
From: Manuel Grizonnet <manuel.grizonnet@orfeo-toolbox.org>
Date: Tue, 26 Mar 2013 10:15:43 +0100
Subject: [PATCH] ENH: rename regionsize extended option in box

---
 .../IO/otbExtendedFilenameToWriterOptions.cxx | 20 +++++++++----------
 Code/IO/otbExtendedFilenameToWriterOptions.h  |  6 +++---
 Code/IO/otbImageFileWriter.txx                |  4 ++--
 Testing/Code/IO/CMakeLists.txt                |  4 ++--
 4 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/Code/IO/otbExtendedFilenameToWriterOptions.cxx b/Code/IO/otbExtendedFilenameToWriterOptions.cxx
index 2fcfd4bd2c..0370b6cbcd 100644
--- a/Code/IO/otbExtendedFilenameToWriterOptions.cxx
+++ b/Code/IO/otbExtendedFilenameToWriterOptions.cxx
@@ -42,7 +42,7 @@ ExtendedFilenameToWriterOptions
   m_Options.optionList.push_back("streaming:type");
   m_Options.optionList.push_back("streaming:sizemode");
   m_Options.optionList.push_back("streaming:sizevalue");
-  m_Options.optionList.push_back("region");
+  m_Options.optionList.push_back("box");
 }
 
 void
@@ -122,19 +122,19 @@ ExtendedFilenameToWriterOptions
     }
 
   //Manage region size to write in output image
-  if(!map["regionsize"].empty())
+  if(!map["box"].empty())
     {
     itksys::RegularExpression reg;
     reg.compile("([^0-9\\.]\s[^0-9\\.]\s[^0-9\\.]\s[^0-9\\.])");
 
-    if(!reg.find(map["regionsize"]))
+    if(!reg.find(map["box"]))
       {
-      m_Options.regionSize.first=true;
-      m_Options.regionSize.second = map["regionsize"];
+      m_Options.box.first=true;
+      m_Options.box.second = map["box"];
       }
     else
       {
-      itkWarningMacro("Unkwown value "<<map["regionsize"]<<" for regionsize. Must be 'xmin ymin xmax ymax', with whitespace as separator");
+      itkWarningMacro("Unkwown value "<<map["box"]<<" for image region to write. Must be 'xmin ymin sizex sizey', with whitespace as separator");
       }
     }
 
@@ -248,16 +248,16 @@ ExtendedFilenameToWriterOptions
 
 bool
 ExtendedFilenameToWriterOptions
-::RegionSizeIsSet() const
+::BoxIsSet() const
 {
-  return m_Options.regionSize.first;
+  return m_Options.box.first;
 }
 
 std::string
 ExtendedFilenameToWriterOptions
-::GetRegionSize() const
+::GetBox() const
 {
-  return m_Options.regionSize.second;
+  return m_Options.box.second;
 }
 
 
diff --git a/Code/IO/otbExtendedFilenameToWriterOptions.h b/Code/IO/otbExtendedFilenameToWriterOptions.h
index eadb3dd221..29fc036043 100644
--- a/Code/IO/otbExtendedFilenameToWriterOptions.h
+++ b/Code/IO/otbExtendedFilenameToWriterOptions.h
@@ -63,7 +63,7 @@ public:
     std::pair<bool,  std::string>                streamingType;
     std::pair<bool,  std::string>                streamingSizeMode;
     std::pair<bool,  double>                     streamingSizeValue;
-    std::pair<bool,  std::string>                regionSize;
+    std::pair<bool,  std::string>                box;
     std::vector<std::string>                     optionList;
   };
 
@@ -83,8 +83,8 @@ public:
   bool StreamingSizeValueIsSet() const;
   double GetStreamingSizeValue() const;
 
-  bool RegionSizeIsSet() const;
-  std::string GetRegionSize() const;
+  bool BoxIsSet() const;
+  std::string GetBox() const;
 
 
 protected:
diff --git a/Code/IO/otbImageFileWriter.txx b/Code/IO/otbImageFileWriter.txx
index 9d676e6090..8652240ac8 100644
--- a/Code/IO/otbImageFileWriter.txx
+++ b/Code/IO/otbImageFileWriter.txx
@@ -472,12 +472,12 @@ ImageFileWriter<TInputImage>
   InputImageRegionType inputRegion = inputPtr->GetLargestPossibleRegion();
 
   /** Parse region size modes */
-  if(m_FilenameHelper->RegionSizeIsSet())
+  if(m_FilenameHelper->BoxIsSet())
     {
     std::cout << "need to set image io" << std::endl;
 
     std::string buf; // Have a buffer string
-    std::stringstream ss(m_FilenameHelper->GetRegionSize()); // Insert the string into a stream
+    std::stringstream ss(m_FilenameHelper->GetBox()); // Insert the string into a stream
 
     std::vector<unsigned int> tokens; // Create vector to hold our words
 
diff --git a/Testing/Code/IO/CMakeLists.txt b/Testing/Code/IO/CMakeLists.txt
index 2404da3c65..5946974aff 100644
--- a/Testing/Code/IO/CMakeLists.txt
+++ b/Testing/Code/IO/CMakeLists.txt
@@ -3812,13 +3812,13 @@ ENDFOREACH(streaming_type)
 
 #region size options test
 
-ADD_TEST(ioTvImageFileWriterExtendedFileName_RegionSize ${IO_TESTS24}
+ADD_TEST(ioTvImageFileWriterExtendedFileName_Box ${IO_TESTS24}
 #--compare-image ${NOTOL}
  #        ${INPUTDATA}/maur_rgb_24bpp.tif
   #       ${TEMP}/ioImageFileWriterExtendedFileName_streamingAuto.tif
   otbImageFileWriterWithExtendedFilename
         ${INPUTDATA}/maur_rgb_24bpp.tif
-        "${TEMP}/ioImageFileWriterExtendedFileName_regionSize.tif?&regionsize=0 0 10 10"
+        "${TEMP}/ioImageFileWriterExtendedFileName_box.tif?&box=2 2 10 10"
         )
 
 #----------------------------------------------------------------------------------
-- 
GitLab