[Insight-users] Display JPEG image
Massinissa Bandou
Massinissa.Bandou at USherbrooke.ca
Tue Feb 14 13:26:56 EST 2012
Hi
I want to display a JPEG Image (413KB). I got no errors or warnings to
build the project but nothing happens when I launch the executable I
got only an empty Ms-dos window.
Do I need to specify the output as a JPEG image?
I know ITK is a good toolkit for image processing but do I need VTK
for any display or visualization even for a simple image???
//==============================================
#include "itkImageFileReader.h"
#include "itkImage.h"
#include "itkImageFileWriter.h"
#include "iostream"
#include "string"
#include "sstream"
using namespace std;
int main( int, char * argv[])
{
typedef float PixelType;
const unsigned int Dimension = 2;
typedef itk::Image< PixelType, Dimension > ImageType;
typedef itk::ImageFileReader< ImageType > ReaderType;
ReaderType::Pointer reader = ReaderType::New();
const char * filename = argv[1];
reader->SetFileName("Top-SideView_Reduced.jpg");
try
{
reader->Update();
}
catch (itk::ExceptionObject & e)
{
std::cerr<<e.GetDescription()<<std::endl;
}
ImageType::Pointer image = reader->GetOutput();
string input;
getline(cin, input);
return 0;
}
//=================================================
Thank you
Massi
More information about the Insight-users
mailing list