[Insight-users] Re: Algorithms/itkOtsuThresholdImageCalculator.txx

Luis Ibanez luis.ibanez@kitware.com
Fri, 11 Oct 2002 15:34:27 -0400


Hi digvijay,

It looks like you copied the code from one of the files in the
Testing/CodeAlgorithms directory.

The code that you should put in the main.cxx is something like


typedef itk::Image<short, 3>                                            
      ImageType;
typedef itk::OtsuThresholdImageCalculator<ImageType>  CalculatorType;

 CalculatorType::Pointer calculator = CalculatorType::New();
calculator->SetImage( image );   // get the image somehow...
calculator->SetNumberOfHistogramBins( 64);

calculator->Compute();

short thresholdResult = calculator->GetThreshold();


Please let us know if you find any further problems,

  Thanks

     Luis


=======================================================

digvijay singh wrote:

>Hi luis!!
>I tried to compile the above file and got an error as
>mentioned below. The CMakeLists.txt file and the
>main.cxx file are attached herewith. Kindly advise
>Thanks
>digvijay
>
>__________________________________________________
>Do you Yahoo!?
>Faith Hill - Exclusive Performances, Videos & More
>http://faith.yahoo.com
>
>
>------------------------------------------------------------------------
>
>
>
>SET(ITK_SOURCE_DIR /opt/tools/itk/Insight_Nightly/Insight)
>SET(ITK_LIB_DIR    /opt/tools/itk/Insight_Nightly/lib)
>SET(ITK_BUILD_DIR /opt/tools/itk/Insight_Nightly/build)
>
>SET(ITK_BINARY_DIR /opt/tools/itk/my_source)
>SET(HOME /home/vertebra/digvijay)
>SET(ITK_PROJECT_DIR ${HOME}/itk/proj_1/Algorithms)
># Include OpenGL
>INCLUDE (${CMAKE_ROOT}/Modules/FindOpenGL.cmake)
>
># Include FLTK
>INCLUDE (${CMAKE_ROOT}/Modules/FindFLTK.cmake)	
>
>INCLUDE_DIRECTORIES(
>${ITK_SOURCE_DIR}/Code/
>
>${ITK_SOURCE_DIR}/Code/IO
>
>${ITK_SOURCE_DIR}/Code/Numerics/Statistics
>${ITK_SOURCE_DIR}/Code/Numerics/FEM
>${ITK_SOURCE_DIR}/Code/Numerics/vxl
>${ITK_SOURCE_DIR}/Code/Numerics/vxl/vcl
>${ITK_SOURCE_DIR}/Code/Common
>${ITK_SOURCE_DIR}/Code/BasicFilters
>${ITK_SOURCE_DIR}/Code/Algorithms
>${ITK_SOURCE_DIR}/Code/IO
>${ITK_SOURCE_DIR}/Auxiliary/FltkImageViewer
>${ITK_BUILD_DIR}
>${ITK_BUILD_DIR}/Code/Numerics/vxl/vcl
>${ITK_BUILD_DIR}/Auxiliary/FltkImageViewer
>${ITK_SOURCE_DIR}/Examples/IBSRValidation/Common
>${FLTK_INCLUDE_PATH}
>${OPENGL_INCLUDE_PATH}
>)
>
>LINK_DIRECTORIES( ${ITK_LIB_DIR} )
>
>LINK_LIBRARIES (
>VXLNumerics
>ITKIO
>ITKAlgorithms
>ITKBasicFilters
>ITKNumerics
>itkpng
>ITKStatistics
>MetaIO
>itkzlib
>param
>vtkFltk
>FltkImageViewer
>FEM
>ITKCommon
>${FLTK_LIBRARY}
>${OPENGL_LIBRARY}
>${GLU_LIBRARY}
>-lpthread -ldl -lm 
>)
>
>ADD_DEFINITIONS(-ftemplate-depth-50 -D_PTHREADS)
>
># Sources of non-templated classes.
>SET(ITKAlgorithms_SRCS
>itkWatershedEquivalencyTable.cxx
>itkWatershedOneWayEquivalencyTable.cxx
>
>itkWatershedMiniPipelineProgressCommand.cxx
>)
>
>ADD_LIBRARY(ITKAlgorithms ${ITKAlgorithms_SRCS})
>TARGET_LINK_LIBRARIES(ITKAlgorithms ITKCommon ITKNumerics)
>
>INSTALL_TARGETS(/lib/InsightToolkit ITKAlgorithms)
>ADD_EXECUTABLE( Otsu  itkOtsuThresholdImageCalculator.txx main.cxx)
>
>
>------------------------------------------------------------------------
>
>
>int main(int argc, char **argv )
>   {
>     itkOtsuThresholdImageCalculator(argc,argv);
>     return 0;
>   }
>