Hi Robert,<div><br></div><div>I was able to open the same file in ImageJ using the following parameters:</div><div><br></div><div>Image Type: 32-bit Real</div><div>Width: 64 pixels</div><div>Height: 64 pixels</div><div>Number of images: 64</div>
<div>Little-Endian Byte Order</div><div><br></div><div>I don't know why RawImageIO is saying that there is just 16384 bytes,</div><div><br></div><div>Thanks & Regards,</div><div>Luis</div><meta charset="utf-8"><div>
<br><div class="gmail_quote">On Tue, Jul 20, 2010 at 1:13 AM, robert tamburo <span dir="ltr"><<a href="mailto:robert.tamburo@gmail.com">robert.tamburo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Your image parameters yield an expected file size larger than that of the file you are trying to read, i.e., 64*64*64*32/8 = 1048576 bytes when your file is only 16384 bytes.<br><br><div class="gmail_quote"><div><div></div>
<div class="h5">On Mon, Jul 19, 2010 at 11:07 PM, Luis Roberto P. Paula <span dir="ltr"><<a href="mailto:luisrpp@gmail.com" target="_blank">luisrpp@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><div><div></div><div class="h5">Hi All,<div><br></div><div>I need to read a 64x64x64 raw image, 32 bit float, Little Endian. To do that I'm using itk::RawImageIO, but for some reason, I'm getting the following runtime error:</div>
<div><br></div><div>
itk::ERROR: RawImageIO(0x1015af510): Read failed: Wanted 1048576 bytes, but read 16384 bytes.</div><div><br></div><div>Does anyone know what might be happening?</div><div><br></div><div>Here is the code:</div><div>___________________________________________________</div>
<div><br></div><div><div>typedef float PixelType;</div><div>const unsigned int DIMENSION = 3;</div><div>typedef itk::Image< PixelType, DIMENSION > ImageType;</div><div>typedef itk::ImageFileReader< ImageType > ReaderType;</div>
<div><br></div><div>int main( int argc, char ** argv )</div><div>{</div><div><span style="white-space:pre-wrap">        </span>char *inputFilename = argv[1];</div><div><br></div><div> itk::RawImageIO<PixelType, DIMENSION>::Pointer io;</div>
<div> io = itk::RawImageIO<PixelType, DIMENSION>::New();</div><div> </div><div> io->SetFileName(inputFilename);</div><div> int dim[DIMENSION] = {64, 64, 64};</div><div> double spacing[DIMENSION] = {1.0, 1.0, 1.0};</div>
<div> double origin[DIMENSION] = {0.0, 0.0, 0.0};</div><div> for(unsigned int i=0; i < DIMENSION; i++) {</div><div> io->SetDimensions(i,dim[i]);</div><div> io->SetSpacing(i,spacing[i]);</div><div> io->SetOrigin(i,origin[i]);</div>
<div> }</div><div> io->SetByteOrderToLittleEndian();</div><div> io->SetComponentType(itk::ImageIOBase::FLOAT);</div><div> io->SetPixelType(itk::ImageIOBase::SCALAR);</div><div> io->SetNumberOfComponents(1);</div>
<div> </div><div> ReaderType::Pointer reader = ReaderType::New();</div><div> reader->SetImageIO(io);</div><div> reader->SetFileName( inputFilename );</div><div> reader->Update();</div><div><br></div><div>
return EXIT_SUCCESS;</div><div>}</div></div><div>___________________________________________________</div><div><br></div><div>Thanks & Regards,</div><div>Luis</div>
<br></div></div>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br>
</blockquote></div><br></div>