[Insight-users] i can't read image with itk
Luis Ibanez
luis.ibanez at kitware.com
Wed Jun 17 06:51:35 EDT 2009
Hi Syrine,
Welcome to ITK !
Please follow first the ITK tutorials:
http://www.itk.org/ITK/help/tutorials.html
In particular:
"Getting Started I"
http://www.itk.org/CourseWare/Training/GettingStartedI-WebPage/index.htm
It will save you a lot of time.
The tutorial guide step-by-step on how to install
and use ITK.
You should also read the ITK Software Guide
http://www.itk.org/ItkSoftwareGuide.pdf
Regarding your code:
A) You are passing a PNG image as input to a reader.
You are currently not passing a DICOM image.
for instructions on how to read a DICOM image,
please look at the Chapter "Reading and Writing Images"
in the ITK Software Guide.
B) You CMakeLists.txt file was copies from the Examples
directory. You may find easier to write your own, by
following the instructions in the Tutorial.
You should only need something like
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND CMAKE_POLICY)
PROJECT(ImageExamples)
FIND_PACKAGE(ITK REQUIRED)
INCLUDE(${ITK_USE_FILE})
ADD_EXECUTABLE(Image2 Image2.cxx )
TARGET_LINK_LIBRARIES(Image2 ITKIO)
and then run the code from the command line.
C) Whenever you are in doubt about whether
your messages make it to the mailing list,
you can check the Archives:
http://www.itk.org/pipermail/insight-users/
see for example:
http://www.itk.org/pipermail/insight-users/2009-June/date.html
Regards,
Luis
------------------------------------------------------------------
On Wed, Jun 17, 2009 at 3:11 AM, Syrine Sahmim <syrine.sahmim at yahoo.fr>wrote:
> Hello,
> I'm a new user of ITK.
> I succeed to install it and run it on c++.
> I won't to read dicom image and display it on screen at the begining.i
> tried the examples included on itk/example but i have many errors when i
> debogue the program.the build is successful.I have tried for many days but i
> can't debogue it . i have send many times to the forum but i don't reseived
> any answer.
> can somebody help me
> Thanks
>
> the c make file is as follow:
> CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
> IF(COMMAND CMAKE_POLICY)
> CMAKE_POLICY(SET CMP0003 NEW)
> ENDIF(COMMAND CMAKE_POLICY)
>
> PROJECT(ImageExamples)
> FIND_PACKAGE(ITK REQUIRED)
> INCLUDE(${ITK_USE_FILE})
> INCLUDE_REGULAR_EXPRESSION("^.*$")
>
> SET(TEMP ${ITK_BINARY_DIR}/Testing/Temporary)
>
> ADD_EXECUTABLE(Image2 Image2.cxx )
> TARGET_LINK_LIBRARIES(Image2 ITKIO)
>
> SET(IMAGE_EXAMPLES2 ${CXX_TEST_PATH}/ImageExamples2)
> IF( NOT ITK_DISABLE_CXX_TESTING )
>
> IF(BUILD_TESTING)
>
> IF(NOT BORLAND)
> ADD_TEST(Image2Test ${IMAGE_EXAMPLES}
> Image2Test ${ITK_SOURCE_DIR}/Examples/Data/BrainMidSagittalSlice.png
> )
> ENDIF(NOT BORLAND)
> ENDIF(BUILD_TESTING)
> ENDIF( NOT ITK_DISABLE_CXX_TESTING )
>
> and the image2.cxx file is :
> #if defined(_MSC_VER)
> #pragma warning ( disable : 4786 )
> #endif
> #include "itkImage.h"
> #include "itkImageFileReader.h"
> int main( int , char * argv[])
> {typedef unsigned char PixelType;
> const unsigned int Dimension = 3;
>
> typedef itk::Image< PixelType, Dimension > ImageType;
> typedef itk::ImageFileReader< ImageType > ReaderType;
> ReaderType::Pointer reader = ReaderType::New();
> const char * filename = argv[1];
> reader->SetFileName( filename );
> reader->Update();
> ImageType::Pointer image = reader->GetOutput();
> return 0;}
>
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090617/bc6ed102/attachment.htm>
More information about the Insight-users
mailing list