# ===================================
SET(USE_QT4 "@QT4_FOUND@")
-
-# =======================
-# == Find dependencies ==
-# =======================
-
-# Find ITK and VTK
SET(ITK_DIR @ITK_DIR@)
-FIND_PACKAGE(ITK REQUIRED)
-INCLUDE(${ITK_USE_FILE})
-
SET(VTK_DIR @VTK_DIR@)
-FIND_PACKAGE(VTK REQUIRED)
-INCLUDE(${VTK_USE_FILE})
-
-# Do not use itk-vtk glue ==> problems ahead!!!
-IF(ITKVtkGlue_LOADED)
- MESSAGE(FATAL_ERROR "ITKVtkGlue module is available. Please re-compile your ITK without it. It could lead to nasty compilation problems... Just waiting for Kitware to solve it.")
-ENDIF(ITKVtkGlue_LOADED)
-
IF(USE_QT4 EQUAL "1")
SET(QT_QMAKE_EXECUTABLE @QT_QMAKE_EXECUTABLE@)
- FIND_PACKAGE(Qt4 REQUIRED)
- INCLUDE(${QT_USE_FILE})
-
- ## Check for required vtk-qt4 modules
- SET(
- vtk_required_modules
- vtkGUISupportQt
- vtkGUISupportQtOpenGL
- )
- FOREACH(vtk_module ${vtk_required_modules})
- IF(NOT ${vtk_module}_LOADED)
- MESSAGE(
- FATAL_ERROR
- "${vtk_module} module is required but not available."
- )
- ENDIF(NOT ${vtk_module}_LOADED)
- ENDFOREACH(vtk_module)
ENDIF(USE_QT4 EQUAL "1")
+# ===========================
+# == Include cmake scripts ==
+# ===========================
+
+FIND_FILE(
+ cpPlugins_FUNCTIONS
+ NAMES cpPlugins_Functions.cmake
+ HINTS /usr/share/cmake /usr/local/share/cmake
+ PATHS @CMAKE_INSTALL_PREFIX@/share/cmake @PROJECT_SOURCE_DIR@/cmake
+ DOC "Where is \"cpPlugins_Functions.cmake\"?"
+ )
+IF(NOT cpPlugins_FUNCTIONS)
+ MESSAGE(FATAL_ERROR "Where is \"cpPlugins_Functions.cmake\"?")
+ENDIF(NOT cpPlugins_FUNCTIONS)
+GET_FILENAME_COMPONENT(
+ cpPlugins_FUNCTIONS_ABSOLUTE ${cpPlugins_FUNCTIONS}
+ ABSOLUTE
+ )
+GET_FILENAME_COMPONENT(
+ cpPlugins_CMAKE_DIR ${cpPlugins_FUNCTIONS_ABSOLUTE}
+ DIRECTORY
+ )
+INCLUDE(${cpPlugins_FUNCTIONS})
+INCLUDE(${cpPlugins_CMAKE_DIR})
+INCLUDE(${cpPlugins_CMAKE_DIR}/cpPlugins_Options.cmake)
+INCLUDE(${cpPlugins_CMAKE_DIR}/cpPlugins_KitwareTools.cmake)
+IF(USE_QT4 EQUAL "1")
+ INCLUDE(${cpPlugins_CMAKE_DIR}/cpPlugins_Qt4Tools.cmake)
+ENDIF(USE_QT4 EQUAL "1")
# =========================
# == Include directories ==
FOREACH(prog ${exec_PROGRAMS})
IF(MSVC)
FIND_PROGRAM(
+ ${prog}_APP
NAMES ${prog}
HINTS /usr /usr/local
PATHS @CMAKE_INSTALL_PREFIX@/bin @PROJECT_BINARY_DIR@/Debug @PROJECT_BINARY_DIR@/Release @PROJECT_BINARY_DIR@/MinSizeRel @PROJECT_BINARY_DIR@/RelWithDebInfo
)
ELSE(MSVC)
FIND_PROGRAM(
- ${prog}
+ ${prog}_APP
NAMES ${prog}
HINTS /usr /usr/local
PATHS @CMAKE_INSTALL_PREFIX@/bin @PROJECT_BINARY_DIR@
#include "SeedWidget.h"
#include <cpPlugins/Image.h>
+#include <cpExtensions/DataStructures/ImageIndexesContainer.h>
#include <cpExtensions/QT/SimpleMPRWidget.h>
#include <cpExtensions/Interaction/ImageInteractorStyle.h>
#include <vtkRenderWindowInteractor.h>
{
this->_AddInput( "ReferenceImage" );
this->_AddOutput< cpPlugins::DataObject >( "Output" );
-
- this->m_Parameters.ConfigureAsBool( "SeedsAreInRealSpace" );
- this->m_Parameters.SetBool( "SeedsAreInRealSpace", false );
}
// -------------------------------------------------------------------------
std::string cpPluginsWidgets::SeedWidget::
_GD0( _TImage* image )
{
- if( image != NULL )
- {
- if( this->m_Parameters.GetBool( "SeedsAreInRealSpace" ) )
- return( this->_GD1_Points( image ) );
- else
- return( this->_GD1_Vertices( image ) );
- }
- else
- return( "Widgets::SeedWidget: Input image dimension not supported." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-std::string cpPluginsWidgets::SeedWidget::
-_GD1_Points( _TImage* image )
-{
+ typedef
+ cpExtensions::DataStructures::ImageIndexesContainer< _TImage::ImageDimension >
+ _TContainer;
typedef cpExtensions::Interaction::ImageInteractorStyle _S;
- typedef itk::Point< double, _TImage::ImageDimension > _P;
- typedef itk::SimpleDataObjectDecorator< std::vector< _P > > _Container;
-
- auto container = this->_CreateITK< _Container >( );
- double aux_pnt[ 3 ];
- unsigned int dim = ( _TImage::ImageDimension < 3 )? _TImage::ImageDimension: 3;
-
- container->Get( ).clear( );
-
- // MPR
- if( this->m_MPRViewer != NULL )
+ if( image != NULL )
{
- for( unsigned int i = 0; i < 4; ++i )
+ auto container = this->_CreateITK< _TContainer >( );
+ double aux_pnt[ 3 ];
+ unsigned int dim = ( _TImage::ImageDimension < 3 )? _TImage::ImageDimension: 3;
+ container->Get( ).clear( );
+
+ // MPR
+ if( this->m_MPRViewer != NULL )
{
- _S* s =
- dynamic_cast< _S* >(
- this->m_MPRViewer->GetInteractor( i )->GetInteractorStyle( )
- );
- if( s != NULL )
+ for( unsigned int i = 0; i < 4; ++i )
{
- if( this->m_Configured )
+ _S* s =
+ dynamic_cast< _S* >(
+ this->m_MPRViewer->GetInteractor( i )->GetInteractorStyle( )
+ );
+ if( s != NULL )
{
- for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
+ if( this->m_Configured )
{
- s->GetSeedAsPoint( i, aux_pnt );
- _P seed;
- for( unsigned int d = 0; d < dim; ++d )
- seed[ d ] = aux_pnt[ d ];
- container->Get( ).push_back( seed );
-
- } // rof
- }
- else
- s->SeedWidgetOn( );
-
- } // fi
-
- } // rof
-
- } // fi
-
- // Single interactor
- _S* s = dynamic_cast< _S* >( this->m_SingleInteractor );
- if( s != NULL )
- {
- if( this->m_Configured )
- {
- for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
- {
- s->GetSeedAsPoint( i, aux_pnt );
- _P seed;
- for( unsigned int d = 0; d < dim; ++d )
- seed[ d ] = aux_pnt[ d ];
- container->Get( ).push_back( seed );
+ for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
+ {
+ s->GetSeedAsPoint( i, aux_pnt );
+ typename _TImage::PointType seed;
+ for( unsigned int d = 0; d < dim; ++d )
+ seed[ d ] = aux_pnt[ d ];
+ typename _TImage::IndexType idx;
+ if( image->TransformPhysicalPointToIndex( seed, idx ) )
+ container->Get( ).push_back( idx );
+
+ } // rof
+ }
+ else
+ s->SeedWidgetOn( );
+
+ } // fi
} // rof
- }
- else
- s->SeedWidgetOn( );
-
- } // fi
- this->m_Configured = true;
- this->GetOutputData( "Output" )->SetITK( container );
- return( "" );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-std::string cpPluginsWidgets::SeedWidget::
-_GD1_Vertices( _TImage* image )
-{
- typedef cpExtensions::Interaction::ImageInteractorStyle _S;
- typedef
- itk::SimpleDataObjectDecorator< std::vector< typename _TImage::IndexType > >
- _Container;
- auto container = this->_CreateITK< _Container >( );
-
- double aux_pnt[ 3 ];
- unsigned int dim = ( _TImage::ImageDimension < 3 )? _TImage::ImageDimension: 3;
+ } // fi
- container->Get( ).clear( );
-
- // MPR
- if( this->m_MPRViewer != NULL )
- {
- for( unsigned int i = 0; i < 4; ++i )
+ // Single interactor
+ _S* s = dynamic_cast< _S* >( this->m_SingleInteractor );
+ if( s != NULL )
{
- _S* s =
- dynamic_cast< _S* >(
- this->m_MPRViewer->GetInteractor( i )->GetInteractorStyle( )
- );
- if( s != NULL )
+ if( this->m_Configured )
{
- if( this->m_Configured )
+ for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
{
- for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
- {
- s->GetSeedAsPoint( i, aux_pnt );
- typename _TImage::PointType seed;
- for( unsigned int d = 0; d < dim; ++d )
- seed[ d ] = aux_pnt[ d ];
- typename _TImage::IndexType idx;
- if( image->TransformPhysicalPointToIndex( seed, idx ) )
- container->Get( ).push_back( idx );
-
- } // rof
- }
- else
- s->SeedWidgetOn( );
-
- } // fi
-
- } // rof
-
- } // fi
-
- // Single interactor
- _S* s = dynamic_cast< _S* >( this->m_SingleInteractor );
- if( s != NULL )
- {
- if( this->m_Configured )
- {
- for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
- {
- s->GetSeedAsPoint( i, aux_pnt );
- typename _TImage::PointType seed;
- for( unsigned int d = 0; d < dim; ++d )
- seed[ d ] = aux_pnt[ d ];
- typename _TImage::IndexType idx;
- if( image->TransformPhysicalPointToIndex( seed, idx ) )
- container->Get( ).push_back( idx );
-
- } // rof
- }
- else
- s->SeedWidgetOn( );
-
- } // fi
- this->m_Configured = true;
-
- this->GetOutputData( "Output" )->SetITK( container );
- return( "" );
+ s->GetSeedAsPoint( i, aux_pnt );
+ typename _TImage::PointType seed;
+ for( unsigned int d = 0; d < dim; ++d )
+ seed[ d ] = aux_pnt[ d ];
+ typename _TImage::IndexType idx;
+ if( image->TransformPhysicalPointToIndex( seed, idx ) )
+ container->Get( ).push_back( idx );
+
+ } // rof
+ }
+ else
+ s->SeedWidgetOn( );
+
+ } // fi
+ this->m_Configured = true;
+ container->SetReferenceImage( image );
+ this->GetOutputData( "Output" )->SetITK( container );
+ return( "" );
+ }
+ else
+ return( "Widgets::SeedWidget: Input image dimension not supported." );
}
// eof - $RCSfile$