[opengtl-commits] [691] set the hints

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 691
Author:   cyrille
Date:     2009-03-26 11:21:10 +0100 (Thu, 26 Mar 2009)

Log Message:
-----------
set the hints

Modified Paths:
--------------
    trunk/OpenGTL/OpenShiva/tools/interpreter/Shiva.cpp


Modified: trunk/OpenGTL/OpenShiva/tools/interpreter/Shiva.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/tools/interpreter/Shiva.cpp	2009-03-26 10:12:53 UTC (rev 690)
+++ trunk/OpenGTL/OpenShiva/tools/interpreter/Shiva.cpp	2009-03-26 10:21:10 UTC (rev 691)
@@ -26,6 +26,7 @@
 // GTLCore Headers
 #include <GTLCore/PixelDescription.h>
 #include <GTLCore/Debug.h>
+#include <GTLCore/Value.h>
 #include <GTLCore/Region.h>
 #include <GTLCore/Type.h>
 #include <GTLCore/Macros_p.h>
@@ -65,7 +66,7 @@
   std::cout << "  -v --version            print the version information" << std::endl;
 }
 #define ARG_IS(a,b) argv[ai] == GTLCore::String(a) or argv[ai] == GTLCore::String(b)
-
+#define max(a,b) ((a) > (b) ? (a) : (b))
 int main(int argc, char** argv)
 {
   GTLCore::String fileName = "";
@@ -187,6 +188,8 @@
     // Load Images
     std::list<GTLCore::AbstractImage*> images;
     std::list<GTLCore::Region> inputDOD;
+    int maxWidth = -1;
+    int maxHeight = -1;
     for( std::list< GTLCore::String >::iterator it = fileNames.begin();
          it != fileNames.end(); ++it )
     {
@@ -204,6 +207,8 @@
       }
       images.push_back( image );
       inputDOD.push_back( region );
+      maxWidth = max(region.width(), maxWidth);
+      maxHeight = max(region.height(), maxHeight);
       if(not userChannelType)
       {
         foreach( const GTLCore::Type* type, image->pixelDescription().channelTypes())
@@ -218,6 +223,8 @@
     GTLCore::PixelDescription pixel( typeChannelImage, channelsCount );
     OpenShiva::Kernel p(channelsCount);
     p.setSource( source );
+    p.setHint(OpenShiva::Kernel::IMAGE_HEIGHT, GTLCore::Value((float)maxHeight));
+    p.setHint(OpenShiva::Kernel::IMAGE_WIDTH, GTLCore::Value((float)maxWidth));
     p.compile();
     if(not p.isCompiled())
     {


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/