[Insight-users] reading dicom image
Syrine Sahmim
syrine.sahmim at yahoo.fr
Sat Jun 20 02:34:14 EDT 2009
Hi mates,
as you advice me last days , i uninstall itk and cmake and visual studio.
i reinstall then cmake 2.6 and itk 3.12 and visual studio 8 (2005).
after that i try to execute again my program to read and write a dicom image but when i debogue the program i obtain thoses error and i don't understand them,can you help me:
'DicomImageReadWrite.exe': Loaded 'C:\Documents and Settings\Sirouna\Bureau\prjitk\pj02dicom_b\debug\DicomImageReadWrite.exe', Symbols loaded.
'DicomImageReadWrite.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded.
'DicomImageReadWrite.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols loaded.
'DicomImageReadWrite.exe': Loaded 'C:\WINDOWS\system32\snmpapi.dll', No symbols loaded.
'DicomImageReadWrite.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', No symbols loaded.
'DicomImageReadWrite.exe': Loaded 'C:\WINDOWS\system32\ws2_32.dll', No symbols loaded.
'DicomImageReadWrite.exe': Loaded 'C:\WINDOWS\system32\ws2help.dll', No symbols loaded.
'DicomImageReadWrite.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', No symbols loaded.
'DicomImageReadWrite.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', No symbols loaded.
'DicomImageReadWrite.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_f75eb16c\msvcp80d.dll', Symbols loaded.
'DicomImageReadWrite.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_f75eb16c\msvcr80d.dll', Symbols loaded.
'DicomImageReadWrite.exe': Loaded 'C:\WINDOWS\system32\user32.dll', No symbols loaded.
'DicomImageReadWrite.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', No symbols loaded.
The program '[1404] DicomImageReadWrite.exe: Native' has exited with code 1 (0x1).
also how can i display the image read on screen?
the program is below
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
#ifdef __BORLANDC__
#define ITK_LEAN_AND_MEAN
#endif
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkRescaleIntensityImageFilter.h"
#include "itkGDCMImageIO.h"
#include <list>
#include <fstream>
int main( int argc, char* argv[] )
{if( argc < 5 )
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " DicomImage OutputDicomImage ";
std::cerr << " OutputImage RescaleDicomImage\n";
return EXIT_FAILURE;
}
typedef signed short InputPixelType;
const unsigned int InputDimension = 2;
typedef itk::Image< InputPixelType, InputDimension > InputImageType;
typedef itk::ImageFileReader< InputImageType > ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName( argv[1] );
typedef itk::GDCMImageIO ImageIOType;
ImageIOType::Pointer gdcmImageIO = ImageIOType::New();
reader->SetImageIO( gdcmImageIO );
try
{
reader->Update();
}
catch (itk::ExceptionObject & e)
{
std::cerr << "exception in file reader " << std::endl;
std::cerr << e << std::endl;
return EXIT_FAILURE;
}
typedef itk::ImageFileWriter< InputImageType > Writer1Type;
Writer1Type::Pointer writer1 = Writer1Type::New();
writer1->SetFileName( argv[2] );
writer1->SetInput( reader->GetOutput() );
writer1->SetImageIO( gdcmImageIO );
try
{
writer1->Update();
}
catch (itk::ExceptionObject & e)
{
std::cerr << "exception in file writer " << std::endl;
std::cerr << e << std::endl;
return EXIT_FAILURE;
}
typedef unsigned char WritePixelType;
typedef itk::Image< WritePixelType, 2 > WriteImageType;
typedef itk::RescaleIntensityImageFilter<
InputImageType, WriteImageType > RescaleFilterType;
RescaleFilterType::Pointer rescaler = RescaleFilterType::New();
rescaler->SetOutputMinimum( 0 );
rescaler->SetOutputMaximum( 255 );
typedef itk::ImageFileWriter< WriteImageType > Writer2Type;
Writer2Type::Pointer writer2 = Writer2Type::New();
writer2->SetFileName( argv[3] );
rescaler->SetInput( reader->GetOutput() );
writer2->SetInput( rescaler->GetOutput() );
try
{
writer2->Update();
}
catch (itk::ExceptionObject & e)
{
std::cerr << "exception in file writer " << std::endl;
std::cerr << e << std::endl;
return EXIT_FAILURE;
}
typedef itk::ImageFileWriter< WriteImageType > Writer3Type;
Writer3Type::Pointer writer3 = Writer3Type::New();
writer3->SetFileName( argv[4] );
writer3->SetInput( rescaler->GetOutput() );
writer3->UseInputMetaDataDictionaryOff ();
writer3->SetImageIO( gdcmImageIO );
try
{
writer3->Update();
}
catch (itk::ExceptionObject & e)
{
std::cerr << "Exception in file writer " << std::endl;
std::cerr << e << std::endl;
return EXIT_FAILURE;
return EXIT_SUCCESS;
}
system("pause");
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090620/754a3397/attachment-0001.htm>
More information about the Insight-users
mailing list