<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Courier;
        panose-1:2 7 4 9 2 2 5 2 4 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
/* List Definitions */
@list l0
        {mso-list-id:2105376564;
        mso-list-type:hybrid;
        mso-list-template-ids:259959932 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-tab-stop:.5in;
        mso-level-number-position:left;
        text-indent:-.25in;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Hi All-<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I am trying to use ITK to read and write (digital microscopy)
jp2 images. In doing so I used the gdcm library and explicitly forced it to
treat the image as a jpeg2000 image. This is as suggested in the forum here (<a
href="http://www.itk.org/pipermail/insight-users/2007-January/020481.html">http://www.itk.org/pipermail/insight-users/2007-January/020481.html</a>).
The code that I used to do so is as under. As of now it is a minimal snippet
that only tries to read the image. When I run this I get an error from itkImageFileReader.txx
and the error message is <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'>ImageIO returns IO region that does not fully contain the
requested region</span></font><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'> <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Code:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'>...<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'>typedef short PixelType;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'>typedef itk::RGBPixel<unsigned char> PixelType;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'> // Same
error appears with RGBAPixelType as well<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'>typedef itk::Image<PixelType, 2> ImageType;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'>typedef itk::ImageFileReader<ImageType> ReaderType;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'>typedef itk::ImageFileWriter<ImageType> WriterType;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'>typedef itk::GDCMImageIO ImageIOType;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'>ReaderType::Pointer reader = ReaderType::New();<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'>ImageIOType::Pointer jp2io = ImageIOType::New();<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-indent:.5in'><font size=2 face=Courier><span
style='font-size:10.0pt;font-family:Courier'>reader->SetFileName(argv[1]);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'> jp2io->SetCompressionType(itk::GDCMImageIO::JPEG2000);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'> reader->SetImageIO(jp2io);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'> <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'> try<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'> {<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'> reader->Update();<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'> }<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'> catch(itk::ExceptionObject & excep)<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'> {<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'> std::cerr<<excep;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'> return EXIT_FAILURE;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'> }<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'>...<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>NOTE: <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<ol style='margin-top:0in' start=1 type=1>
<li class=MsoNormal style='mso-list:l0 level1 lfo1'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>When I try and use the stand
alone exe’s provided by the folks at openjpeg, and use it to write a
bmp, the bmp is filled with random data. ITK does not go all the way there
and trows an exception much before that.<o:p></o:p></span></font></li>
<li class=MsoNormal style='mso-list:l0 level1 lfo1'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>The source images where encoded
using the kakadu libraries.<o:p></o:p></span></font></li>
</ol>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I would really appreciate if somebody could point out, what
it is that I am doing wrong, and if so what is the fix?<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>--Prashanth<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Courier><span style='font-size:10.0pt;
font-family:Courier'><o:p> </o:p></span></font></p>
</div>
</body>
</html>