]> Creatis software - clitk.git/commitdiff
min max (to remove)
authordsarrut <dsarrut>
Wed, 30 Jun 2010 06:15:08 +0000 (06:15 +0000)
committerdsarrut <dsarrut>
Wed, 30 Jun 2010 06:15:08 +0000 (06:15 +0000)
tools/clitkMinMaxMask.cxx [new file with mode: 0644]
tools/clitkMinMaxMask.ggo [new file with mode: 0644]

diff --git a/tools/clitkMinMaxMask.cxx b/tools/clitkMinMaxMask.cxx
new file mode 100644 (file)
index 0000000..8a41a8a
--- /dev/null
@@ -0,0 +1,90 @@
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.fr/
+  - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
+  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the copyright notices for more information.
+
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+======================================================================-====*/
+
+// clitk
+#include "clitkMinMaxMask_ggo.h"
+#include "clitkIO.h"
+#include "clitkImageCommon.h"
+#include "itkConstSliceIterator.h"
+#include "itkImageRegionIteratorWithIndex.h"
+
+//--------------------------------------------------------------------
+int main(int argc, char * argv[])
+{
+
+  // Init command line
+  GGO(clitkMinMaxMask, args_info);
+  CLITK_INIT;
+
+  typedef short PixelType;
+  static const int Dim=3;
+  typedef itk::Image<PixelType, Dim> ImageType;
+
+  ImageType::Pointer input1;
+  ImageType::Pointer input2;
+  input1 = clitk::readImage<ImageType>(args_info.input1_arg, false);
+  input2 = clitk::readImage<ImageType>(args_info.input2_arg, false);
+  
+  typedef itk::ImageRegionIteratorWithIndex<ImageType> IteratorType;
+  IteratorType it = IteratorType(input1, input1->GetLargestPossibleRegion());
+  it.GoToBegin();
+  ImageType::IndexType first1=it.GetIndex();
+  ImageType::IndexType last1=it.GetIndex();
+  bool firstFound = false;
+  while (!it.IsAtEnd()) {
+    if (!firstFound) {
+      if (it.Get() == 1) {
+        firstFound = true;
+        first1 = it.GetIndex();
+      }
+    }
+    else {
+      if (it.Get() == 1) {
+        last1 = it.GetIndex();
+      }
+    }
+    ++it;
+  }
+  
+  // typedef itk::ImageRegionIteratorWithIndex<ImageType> IteratorType;
+  it = IteratorType(input2, input2->GetLargestPossibleRegion());
+  it.GoToBegin();
+  ImageType::IndexType first2=it.GetIndex();
+  ImageType::IndexType last2=it.GetIndex();
+  firstFound = false;
+  while (!it.IsAtEnd()) {
+    if (!firstFound) {
+      if (it.Get() == 1) {
+        firstFound = true;
+        first2 = it.GetIndex();
+      }
+    }
+    else {
+      if (it.Get() == 1) {
+        last2 = it.GetIndex();
+      }
+    }
+    ++it;
+  }
+  
+  std::cout << " --i1 " << first1[2] << " --f1 " << last1[2]
+            << " --i2 " << first2[2] << " --f2 " << last2[2] << std::endl;
+
+  return EXIT_SUCCESS;
+} // This is the end, my friend
+//--------------------------------------------------------------------
diff --git a/tools/clitkMinMaxMask.ggo b/tools/clitkMinMaxMask.ggo
new file mode 100644 (file)
index 0000000..8ffc357
--- /dev/null
@@ -0,0 +1,10 @@
+#File clitkExtractLungs.ggo
+package "clitkMinMaxMask"
+version "1.0"
+purpose "ssdfgsfg ssdf g."
+
+option "config"                -  "Config file"                  string        no
+option "verbose"        v  "Verbose"                     flag          off
+
+option "input1"         i      "Input mask image filename"       string        yes
+option "input2"         j      "Input mask  image filename"      string        yes