[Insight-users] Re : Re : others pbm on reading image from file
Syrine Sahmim
syrine.sahmim at yahoo.fr
Wed Jun 17 03:47:24 EDT 2009
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;}
________________________________
De : Patrik Brynolfsson <patrik.brynolfsson at gmail.com>
À : Syrine Sahmim <syrine.sahmim at yahoo.fr>
Envoyé le : Mercredi, 17 Juin 2009, 8h39mn 01s
Objet : Re: Re : others pbm on reading image from file
What errors do you get? Is it with the CMake or when compiling the code? I have had problems posting to the forum also, especially when sending from my e-mail. If I post on the Nabble page, http://n2.nabble.com/ITK-Insight-Users-f2283740.html I see that the post goes out to all users, so you can try that.
If you're trying to read a DICOM image you might want to look i the ITKSoftwareGuide in chapter 7.12, there you have examples of reading DICOM images.
I don't know if these lines will help, but it is a start:
typedef itk::GDCMImageIO ImageIOType;
ImageIOType::Pointer dicomIO = ImageIOType::New();
reader->SetImageIO( dicomIO );
You have to add these prior to reading the image from file. Maybe you have to add more code. Anyway, look up chapter 7.12!
Regards
Patrik
2009/6/17 Syrine Sahmim <syrine.sahmim at yahoo.fr>
Good morning ,
I tried with the community but i don't receive any answer. May be i don't send correctly the msg or may be the adress mail i had used was faulty.Would send me the adress of the community or transmit my problem to the community:
i try to read an image with itk but i have errors.
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;}
Regards,
Syrine
________________________________
De : Patrik Brynolfsson <patrik.brynolfsson at gmail.com>
À : Syrine Sahmim <syrine.sahmim at yahoo.fr>
Envoyé le : Vendredi, 12 Juin 2009, 8h41mn 54s
Objet : Re: others pbm on reading image from file
Hello,
I'm sorry but I'm really new to ITK and can't answer your question. Perhaps you didn't install ITK correctly, or missed something in the CMake-file, but I simply don't know. Check with the community, they might help you!
Regards,
Patrik
2009/6/11 Syrine Sahmim <syrine.sahmim at yahoo.fr>
Hi,
thanks for your help but i succeed the execution
and then i tried to excute another examples "InsightToolkit-3.12.0\Examples\DataRepresentation\Image\image2.cxx" but i have many debug like
Exception non gérée à 0x7c81eb33 dans Image2.exe : Exception Microsoft C++ : itk::ImageFileReaderException à l'emplacement mémoire 0x0136fb68..
Exception non gérée à 0x0040fe28 dans Image2.exe : 0xC0000005: Violation d'accès lors de la lecture de l'emplacement 0x00000000.
...etc
how can i eliminate those exception. there's any others recommandations that i must do them to succeed this test.
thanks
________________________________
De : Patrik Brynolfsson <patrik.brynolfsson at gmail.com>
À : Syrine Sahmim <syrine.sahmim at yahoo.fr>
Envoyé le : Jeudi, 11 Juin 2009, 8h36mn 49s
Objet : Re: Re : [Insight-users] pbms of running
Type "cmd" in the "Run..." option in the start menu in windows. change catalog to where your program is located (e.g. cd c:\program\my programs\debug\) run the program from there by typing the name of the program (e.g. helloworld)
2009/6/10 Syrine Sahmim <syrine.sahmim at yahoo.fr>
how to run it from the command line plz?
________________________________
De : Patrik Brynolfsson <patrik.brynolfsson at gmail.com>
À : Syrine Sahmim <syrine.sahmim at yahoo.fr>
Envoyé le : Mercredi, 10 Juin 2009, 15h17mn 03s
Objet : Re: [Insight-users] pbms of running
Are you running Windows? In that case, are you running your program from the command line? If you're not, the command window just pops up momentarliy. Try running it from the command line and see if it works better.
2009/6/10 Syrine Sahmim <syrine.sahmim at yahoo.fr>
Hi,
i tried to run the example code of "helloworld.cxx". i have build itt successfully but the problem that i doesn't produce the msg " itk hello world"..i do'n t know what'is the error enev it never mentionned
thanks
_____________________________________
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/56c80399/attachment-0001.htm>
More information about the Insight-users
mailing list