[Insight-users] Reading Jpeg file
Bill Lorensen
bill.lorensen at gmail.com
Fri Oct 24 09:06:40 EDT 2008
Liqin,
Can you please send the command line you are using and the exact
message printed by the exception?
Bill
On Wed, Oct 22, 2008 at 6:20 PM, Wang, Liqin <Wang.Liqin at mayo.edu> wrote:
> Hi,All
>
> I want to read the Jpeg file by using the following codes:
>
>
> //++++++++++++++++++++++++++++++
> typedef itk::ImageFileReader< ImageType > ReaderType;
> typedef itk::JPEGImageIO ImageIOType;
> // Software Guide : EndCodeSnippet
>
> ImageIOType::Pointer jpegIO = ImageIOType::New();
>
> ReaderType::Pointer reader = ReaderType::New();
> const char * filename = argv[1];
> reader->SetFileName( filename );
> reader->SetImageIO( jpegIO );
> reader->Update();
>
>
>
> //+++++++++++++++++++++++++++
>
>
> But I kept getting the exception in the following function:
>
> void JPEGImageIO::ReadImageInformation()
> {
> m_Spacing[0] = 1.0; // We'll look for JPEG pixel size information
> later,
> m_Spacing[1] = 1.0; // but set the defaults now
>
> m_Origin[0] = 0.0;
> m_Origin[1] = 0.0;
>
> // use this class so return will call close
> JPEGFileWrapper JPEGfp(m_FileName.c_str(),"rb");
> FILE* fp = JPEGfp.m_FilePointer;
> if(!fp)
> {
> itkExceptionMacro("Error JPEGImageIO could not open file: "
> << this->GetFileName());
> return;
> }
> .
> .
> .
>
>
> Attached is a sample jpeg image used to test the program.
>
> Thanks for helps.
>
> Liqin
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>
More information about the Insight-users
mailing list