[opengtl-commits] [692] set the hints |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/opengtl-commits Archives
]
Revision: 692
Author: cyrille
Date: 2009-03-26 11:21:24 +0100 (Thu, 26 Mar 2009)
Log Message:
-----------
set the hints
Modified Paths:
--------------
trunk/GTLDesigner/src/gtldesigner.cpp
Modified: trunk/GTLDesigner/src/gtldesigner.cpp
===================================================================
--- trunk/GTLDesigner/src/gtldesigner.cpp 2009-03-26 10:21:10 UTC (rev 691)
+++ trunk/GTLDesigner/src/gtldesigner.cpp 2009-03-26 10:21:24 UTC (rev 692)
@@ -45,6 +45,7 @@
#include <GTLCore/PixelDescription.h>
#include <GTLCore/Region.h>
+#include <GTLCore/Value.h>
#include <GTLImageIO/ImageDCRegistry.h>
#include <GTLImageIO/ImageDC.h>
@@ -298,8 +299,38 @@
m_listView->setModel( new ErrorMessagesModel( m.compilationErrors() ) );
}
}
+
void GTLDesigner::executeShiva()
{
+ int maxWidth = -1;
+ int maxHeight = -1;
+ std::list<GTLCore::AbstractImage*> inputImages;
+ std::list<GTLCore::Region> inputDOD;
+ for( int k = 0; k < ui_imagesDocker->listImages->count(); ++k)
+ {
+ GTLCore::String fileName = ui_imagesDocker->listImages->item( k )->data( Qt::UserRole ).toString().toLatin1().data();
+ const GTLImageIO::ImageDC* decoder = GTLImageIO::ImageDCRegistry::instance()->decoder( fileName );
+ if( not decoder )
+ {
+ QMessageBox::warning(this, tr("GTLDesigner"),
+ tr("Cannot read image %1..")
+ .arg(fileName.c_str()));
+ }
+ GTLCore::Region region;
+ GTLCore::AbstractImage* image = decoder->decode( fileName, ®ion, 0 );
+ if( not image )
+ {
+ QMessageBox::warning(this, tr("GTLDesigner"),
+ tr("Cannot read image %1..")
+ .arg(fileName.c_str()));
+ }
+ inputImages.push_back( image );
+ maxWidth = qMax(region.width(), maxWidth);
+ maxHeight = qMax(region.height(), maxHeight);
+ inputDOD.push_back( region );
+ }
+ m_kernel->setHint(OpenShiva::Kernel::IMAGE_HEIGHT, GTLCore::Value((float)maxHeight));
+ m_kernel->setHint(OpenShiva::Kernel::IMAGE_WIDTH, GTLCore::Value((float)maxWidth));
m_kernel->compile();
if(m_kernel->isCompiled())
{
@@ -309,29 +340,6 @@
{
region = m_kernel->generated();
}
- std::list<GTLCore::AbstractImage*> inputImages;
- std::list<GTLCore::Region> inputDOD;
- for( int k = 0; k < ui_imagesDocker->listImages->count(); ++k)
- {
- GTLCore::String fileName = ui_imagesDocker->listImages->item( k )->data( Qt::UserRole ).toString().toLatin1().data();
- const GTLImageIO::ImageDC* decoder = GTLImageIO::ImageDCRegistry::instance()->decoder( fileName );
- if( not decoder )
- {
- QMessageBox::warning(this, tr("GTLDesigner"),
- tr("Cannot read image %1..")
- .arg(fileName.c_str()));
- }
- GTLCore::Region region;
- GTLCore::AbstractImage* image = decoder->decode( fileName, ®ion, 0 );
- if( not image )
- {
- QMessageBox::warning(this, tr("GTLDesigner"),
- tr("Cannot read image %1..")
- .arg(fileName.c_str()));
- }
- inputImages.push_back( image );
- inputDOD.push_back( region );
- }
if( m_kernel->hasChangedFunction() )
{
int i = 0;