Commit 0a23f72a authored by lealv's avatar lealv
Browse files

FEATURE 165 - CTEST : remove old test actions procedure

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@1161 ec899d31-69d1-42ba-9299-647d76f65fb3
parent 4751a4cc
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2013 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
// -- Core stuff
#include <Application.h>
#include <MainWindow.h>
#include <InteractiveViewer.h>
#include <Core.h>
#include <ExtensionManager.h>
#include <Action.h>
using namespace camitk;
// Complete description
// If you modify this description, PLEASE do not forget to
// also update the associated "camitk-imp-prologue.1.in" man page
// (both texts should only be marginally different)
static const char* description = "This is a test application, it is "
"not intended to be used as a CamiTK application."
"\n -i <file> is for test context and will not be modified";
// usage for this application
static void usage(char *appName) {
std::cout << appName << std::endl;
std::cout << std::endl;
std::cout << "Usage: " << appName << " -i <fileIn> -d <OutDirectory>" << std::endl;
std::cout << "Built using " << Core::version << std::endl;
std::cout << std::endl;
std::cout << description << std::endl;
std::cout << std::endl;
std::cout << "Options:" << endl;
std::cout << "Arguments:" << std::endl;
std::cout << " -i <file> input file on which the tested action will process" << std::endl;
}
int ItkFiltersTest(int argc, char *argv[]) {
try {
int ret = EXIT_SUCCESS;
bool inputTest = false;
QFileInfo ifile;
std::cout << "Start " << argv[0] << std::endl;
for (int i=1; i<argc; i++)
{
if (!strcmp( argv[i],"-i" )) {
ifile.setFile( argv[i+1] );
inputTest = true;
}
}
// if no or not correct options provided
if ( !inputTest )
{
if (argc>1)
{
std::cout << "Argument errors: ";
for(int i=1; i<argc; i++)
{
std::cout << "[" << argv[i] << "] ";
}
}
usage(argv[0]);
ret = EXIT_SUCCESS;
return ret;
}
else
{
std::cout << "Arguments OK: ";
bool extOpen = false;
// init the camitk application context
Application a( "action-test", argc, argv, false, true );//No autoload of actions and components here.
a.getMainWindow()->setCentralViewer( InteractiveViewer::getAxialViewer() );
QStringList extensionDir = Core::getComponentDirectories();
QString ActionDir;
foreach( ActionDir, extensionDir )
{
std::cout << "each : ";
//Open this type of component extension to apply on the action to be tested.
if ( ExtensionManager::loadExtension( ExtensionManager::COMPONENT, ActionDir + "/itkimage-debug.dll" ))
{
std::cout << "Component extension open OK : ";
extOpen = true;
}
}
if( extOpen )
{
Component* comp = Application::open( ifile.absoluteFilePath() );
if( comp )
{
std::cout << "Open file OK : ";
QStringList extensionDir = Core::getActionDirectories();
QString ActionDir;
Action::ApplyStatus status;
foreach( ActionDir, extensionDir )
{
//Load this specific action extension only
if ( ExtensionManager::loadExtension( ExtensionManager::ACTION, ActionDir + "/itkfilters-debug.dll" ))
{
std::cout << "Action extension OK : ";
ActionList actl = Application::getActions( comp );
foreach(Action *action , actl )
{
std::cout << "action-> getname() " << action->getName().data();
action->setInputComponent( comp );
status = action->apply();
if( status != Action::SUCCESS )
{
std::cout << "action-> getname() " << action->getName().data() << "FAILED";
ret = EXIT_FAILURE;
break;
}
}
}
else
{
ret = EXIT_FAILURE;
}
}
}
else
{
ret = EXIT_FAILURE;
}
}
else
{
ret = EXIT_FAILURE;
}
}
return ret;
}
catch (camitk::AbortException& e) {
//QMessageBox::warning(NULL, QString(argv[0]) + " aborted...", "AbortException:" + QString(e.what()));
std::cout << argv[0] << " aborted..." << std::endl << "camitk AbortException:" << std::endl << e.what() << std::endl;
return EXIT_FAILURE;
}
catch (std::exception& e) {
//QMessageBox::warning(NULL, QString(argv[0]) + " aborted...", "AbortException:" + QString(e.what()));
std::cout << argv[0] << " aborted..." << std::endl << "std AbortException:" << std::endl << e.what() << std::endl;
return EXIT_FAILURE;
}
catch (...) {
//QMessageBox::warning(NULL, QString(argv[0]) + " aborted...", "Unknown Exception");
std::cout << argv[0] << " aborted..." << std::endl << "Unknown Exception" << std::endl;
return EXIT_FAILURE;
}
}
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2013 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
// -- Core stuff
#include <Application.h>
#include <MainWindow.h>
#include <InteractiveViewer.h>
#include <Core.h>
#include <ExtensionManager.h>
#include <Action.h>
using namespace camitk;
// Complete description
// If you modify this description, PLEASE do not forget to
// also update the associated "camitk-imp-prologue.1.in" man page
// (both texts should only be marginally different)
static const char* description = "This is a test application, it is "
"not intended to be used as a CamiTK application."
"\n -i <file> is for test context and will not be modified";
// usage for this application
static void usage(char *appName) {
std::cout << appName << std::endl;
std::cout << std::endl;
std::cout << "Usage: " << appName << " -i <fileIn> -d <OutDirectory>" << std::endl;
std::cout << "Built using " << Core::version << std::endl;
std::cout << std::endl;
std::cout << description << std::endl;
std::cout << std::endl;
std::cout << "Options:" << endl;
std::cout << "Arguments:" << std::endl;
std::cout << " -i <file> input file on which the tested action will process" << std::endl;
}
int ItkSegmentationTest(int argc, char *argv[]) {
try {
int ret = EXIT_SUCCESS;
bool inputTest = false;
QFileInfo ifile;
std::cout << "Start " << argv[0] << std::endl;
for (int i=1; i<argc; i++)
{
if (!strcmp( argv[i],"-i" )) {
ifile.setFile( argv[i+1] );
inputTest = true;
}
}
// if no or not correct options provided
if ( !inputTest )
{
if (argc>1)
{
std::cout << "Argument errors: ";
for(int i=1; i<argc; i++)
{
std::cout << "[" << argv[i] << "] ";
}
}
usage(argv[0]);
ret = EXIT_SUCCESS;
return ret;
}
else
{
std::cout << "Arguments OK: ";
bool extOpen = false;
// init the camitk application context
Application a( "action-test", argc, argv, false, true );//No autoload of actions and components here.
a.getMainWindow()->setCentralViewer( InteractiveViewer::getAxialViewer() );
QStringList extensionDir = Core::getComponentDirectories();
QString ActionDir;
foreach( ActionDir, extensionDir )
{
std::cout << "each : ";
//Open this type of component extension to apply on the action to be tested.
if ( ExtensionManager::loadExtension( ExtensionManager::COMPONENT, ActionDir + "/itkimage-debug.dll" ))
{
std::cout << "Component extension open OK : ";
extOpen = true;
}
}
if( extOpen )
{
Component* comp = Application::open( ifile.absoluteFilePath() );
if( comp )
{
std::cout << "Open file OK : ";
QStringList extensionDir = Core::getActionDirectories();
QString ActionDir;
Action::ApplyStatus status;
foreach( ActionDir, extensionDir )
{
//Load this specific action extension only
if ( ExtensionManager::loadExtension( ExtensionManager::ACTION, ActionDir + "/itksegmentation-debug.dll" ))
{
std::cout << "Action extension OK : ";
ActionList actl = Application::getActions( comp );
foreach(Action *action , actl )
{
std::cout << "action-> getname() " << action->getName().data();
action->setInputComponent( comp );
status = action->apply();
if( status != Action::SUCCESS )
{
std::cout << "action-> getname() " << action->getName().data() << "FAILED";
ret = EXIT_FAILURE;
break;
}
}
}
else
{
ret = EXIT_FAILURE;
}
}
}
else
{
ret = EXIT_FAILURE;
}
}
else
{
ret = EXIT_FAILURE;
}
}
return ret;
}
catch (camitk::AbortException& e) {
//QMessageBox::warning(NULL, QString(argv[0]) + " aborted...", "AbortException:" + QString(e.what()));
std::cout << argv[0] << " aborted..." << std::endl << "camitk AbortException:" << std::endl << e.what() << std::endl;
return EXIT_FAILURE;
}
catch (std::exception& e) {
//QMessageBox::warning(NULL, QString(argv[0]) + " aborted...", "AbortException:" + QString(e.what()));
std::cout << argv[0] << " aborted..." << std::endl << "std AbortException:" << std::endl << e.what() << std::endl;
return EXIT_FAILURE;
}
catch (...) {
//QMessageBox::warning(NULL, QString(argv[0]) + " aborted...", "Unknown Exception");
std::cout << argv[0] << " aborted..." << std::endl << "Unknown Exception" << std::endl;
return EXIT_FAILURE;
}
}
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2013 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
// -- Core stuff
#include <Application.h>
#include <MainWindow.h>
#include <InteractiveViewer.h>
#include <Core.h>
#include <ExtensionManager.h>
#include <Action.h>
using namespace camitk;
// Complete description
// If you modify this description, PLEASE do not forget to
// also update the associated "camitk-imp-prologue.1.in" man page
// (both texts should only be marginally different)
static const char* description = "This is a test application, it is "
"not intended to be used as a CamiTK application."
"\n -i <file> is for test context and will not be modified";
// usage for this application
static void usage(char *appName) {
std::cout << appName << std::endl;
std::cout << std::endl;
std::cout << "Usage: " << appName << " -i <fileIn> -d <OutDirectory>" << std::endl;
std::cout << "Built using " << Core::version << std::endl;
std::cout << std::endl;
std::cout << description << std::endl;
std::cout << std::endl;
std::cout << "Options:" << endl;
std::cout << "Arguments:" << std::endl;
std::cout << " -i <file> input file on which the tested action will process" << std::endl;
}
int ArbitrarySliceTest(int argc, char *argv[]) {
try {
int ret = EXIT_SUCCESS;
bool inputTest = false;
QFileInfo ifile;
std::cout << "Start " << argv[0] << std::endl;
for (int i=1; i<argc; i++)
{
if (!strcmp( argv[i],"-i" )) {
ifile.setFile( argv[i+1] );
inputTest = true;
}
}
// if no or not correct options provided
if ( !inputTest )
{
if (argc>1)
{
std::cout << "Argument errors: ";
for(int i=1; i<argc; i++)
{
std::cout << "[" << argv[i] << "] ";
}
}
usage(argv[0]);
ret = EXIT_SUCCESS;
return ret;
}
else
{
std::cout << "Arguments OK: ";
bool extOpen = false;
// init the camitk application context
Application a( "action-test", argc, argv, false, true );//No autoload of actions and components here.
a.getMainWindow()->setCentralViewer( InteractiveViewer::getAxialViewer() );
QStringList extensionDir = Core::getComponentDirectories();
QString ActionDir;
foreach( ActionDir, extensionDir )
{
std::cout << "each : ";
//Open this type of component extension to apply on the action to be tested.
if ( ExtensionManager::loadExtension( ExtensionManager::COMPONENT, ActionDir + "/itkimage-debug.dll" ))
{
std::cout << "Component extension open OK : ";
extOpen = true;
}
}
if( extOpen )
{
Component* comp = Application::open( ifile.absoluteFilePath() );
if( comp )
{
std::cout << "Open file OK : ";
QStringList extensionDir = Core::getActionDirectories();
QString ActionDir;
Action::ApplyStatus status;
foreach( ActionDir, extensionDir )
{
//Load this specific action extension only
if ( ExtensionManager::loadExtension( ExtensionManager::ACTION, ActionDir + "/arbitraryslice-debug.dll" ))
{
std::cout << "Action extension OK : ";
ActionList actl = Application::getActions( comp );
foreach(Action *action , actl )
{
std::cout << "action-> getname() " << action->getName().data();
action->setInputComponent( comp );
status = action->apply();
if( status != Action::SUCCESS )
{
std::cout << "action-> getname() " << action->getName().data() << "FAILED";
ret = EXIT_FAILURE;
break;
}
}
}
else
{
ret = EXIT_FAILURE;
}
}
}
else
{
ret = EXIT_FAILURE;
}
}
else
{
ret = EXIT_FAILURE;
}
}
return ret;
}
catch (camitk::AbortException& e) {
//QMessageBox::warning(NULL, QString(argv[0]) + " aborted...", "AbortException:" + QString(e.what()));
std::cout << argv[0] << " aborted..." << std::endl << "camitk AbortException:" << std::endl << e.what() << std::endl;
return EXIT_FAILURE;
}
catch (std::exception& e) {
//QMessageBox::warning(NULL, QString(argv[0]) + " aborted...", "AbortException:" + QString(e.what()));
std::cout << argv[0] << " aborted..." << std::endl << "std AbortException:" << std::endl << e.what() << std::endl;
return EXIT_FAILURE;
}
catch (...) {
//QMessageBox::warning(NULL, QString(argv[0]) + " aborted...", "Unknown Exception");
std::cout << argv[0] << " aborted..." << std::endl << "Unknown Exception" << std::endl;
return EXIT_FAILURE;
}
}
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2013 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
// -- Core stuff
#include <Application.h>
#include <MainWindow.h>
#include <InteractiveViewer.h>
#include <Core.h>
#include <ExtensionManager.h>
#include <Action.h>
using namespace camitk;
// Complete description
// If you modify this description, PLEASE do not forget to
// also update the associated "camitk-imp-prologue.1.in" man page
// (both texts should only be marginally different)
static const char* description = "This is a test application, it is "
"not intended to be used as a CamiTK application."
"\n -i <file> is for test context and will not be modified";
// usage for this application
static void usage(char *appName) {
std::cout << appName << std::endl;
std::cout << std::endl;
std::cout << "Usage: " << appName << " -i <fileIn> -d <OutDirectory>" << std::endl;
std::cout << "Built using " << Core::version << std::endl;
std::cout << std::endl;
std::cout << description << std::endl;
std::cout << std::endl;
std::cout << "Options:" << endl;