[Insight-users] ImageFileReader bug
Bradley Lowekamp
blowekamp at mail.nih.gov
Thu Dec 16 11:00:46 EST 2010
Hello,
Sorry for arriving to the discussion late. Matt is right that the new VTK image reader should address this issue. However to use it takes a little bit of work. itkVTKImageIO2 is included with the 3.20 release which I believe is what you are running.
To utilize this IO, you must build ITK with REVIEW enabled. Then include the following in your code:
#include "itkVTKImageIO2Factory.h"
> int main(int argc, char * argv[])
> {
itk::VTKImageIO2Factory::RegisterOneFactory();
Please let us know if this does not work for you.
Brad
On Dec 16, 2010, at 1:40 AM, Sara Rolfe wrote:
> Thanks, I can give this a try. I'd also like to provide my images so others can try and see if they have the same issue. Links to the files and a condensed version of my original code are below. The first file is a 3D, 3 component vector image, which is causing my code to stall. The second is a 3D, 4 component vector image. I've been able to read this (and several different length vector images) without any trouble. To read this one using the code I sent, I just change the variable "numberOfComponents" from 3 to 4.
>
> Thanks,
> Sara
>
> http://dl.dropbox.com/u/16899529/ITKdata/PropertyMaskMultiDim_3.vtk
>
> http://dl.dropbox.com/u/16899529/ITKdata/PropertyMaskMultiDim_4.vtk
>
>
> #include "itkImageFileReader.h"
> #include "itkImage.h"
>
> int main(int argc, char * argv[])
> {
> const int numberOfComponents = 3; // Change this to 4 to try with the other file
> typedef itk::Vector< double, numberOfComponents > PixelType;
> typedef itk::Image< PixelType, 3 > ImageType;
> typedef itk::ImageFileReader< ImageType > ReaderType;
>
> const char * inputImageFileName = argv[1];
>
> ReaderType::Pointer reader = ReaderType::New();
> reader->SetFileName( inputImageFileName );
> reader->Update();
>
> return EXIT_SUCCESS;
> }
>
>
> On Dec 15, 2010, at 10:13 PM, Matt McCormick wrote:
>
>> Sara Rolfe <smrolfe <at> u.washington.edu> writes:
>>
>>>
>>> That sounds just like what I'm experiencing, though I only have this
>>> problem for 3 component vector images. However, I just installed the
>>> latest git version of ITK early last week, and it looks like this
>>> issue was closed in October.
>>>
>>
>> Sorry for the false trail, then.
>>
>> The best way to find the problem may be to compile your program with debugging
>> symbols (CMAKE_BUILD_TYPE=Debug), and run in the debugger, breaking at
>> Code/IO/VTKImageIO.cxx in the method
>> void VTKImageIO::InternalReadImageInformation(std::ifstream & file)
>>
>> Stepping through the code may be informative. Pay particular attention to
>> 240 for ( bool readScalars = false; !readScalars; ).
>> It might not be getting out of that loop.
>>
>> Matt
>>
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-users
>
> <ATT00001..txt>
========================================================
Bradley Lowekamp
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine
blowekamp at mail.nih.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20101216/4476b958/attachment.htm>
More information about the Insight-users
mailing list