[Insight-users] writing large files with VTKImageIO...possible bug?

Lyubomir G. Zagorchev Lyubomir.G.Zagorchev at Dartmouth.edu
Wed Oct 21 09:57:59 EDT 2009


Hi Luis,

Thanks for your quick reply.

I tried to figure out why the writer was crashing and I wasn't thinking about the pipeline behavior at all. The volumes that I have to be able to write out are about 800Mb and a duplicate image buffer of that size is definitely a problem. I have considered switching to another file format but for portability issues I would rather stick to vtk. Using ASCII with such files also isn't an option, so the only reasonable solution would be to swap back after writing, but that also has problems... I am thinking that I will have to switch to a 64bit machine soon and that should solve the problem. Until then I can work with my modification. If I am the only user with this issue then modifying the framework isn't worth it.

Best regards,

Lyubomir



-- You wrote:
Hi Lyubomir,

Thanks for pointing this out.

You are correct in that a duplicate of the image buffer
is created here, and that its presence may be an issue
for large images.

However, your suggested solution raise the concern
that the ByteSwapper will be modifying the pixel buffer
of the image that we are writing to disk.

This is in general a violation of the data pipeline behavior
of managing the output of a filter as a const object.

It becomes particularly important if you had a pipeline
such as:

  writer->SetInput( filterA->GetOutput() );
  filterB->SetInput( filterA->GeOutput() );

In this case, the action of the writer will corrupt the
pixel buffer of filterA's image output, and will pass
incorrect information as input to filterB.

...one option for maintaining your suggested solution
could be to revert the potential swapping after writing
the image... but still that requires to assume that no
other filter is accessing that output image of filterA
before we finish unswapping.

One potential option is for you to consider the use
of the MetaImage file format. This format does not
unswap the data, it simply write down the endiannes
in the file. Additionally it provides support for streaming,
which can be useful if you are dealing with very large
images....


    Please let us know if you would like to consider
    these options,


           Thanks


                 Luis



More information about the Insight-users mailing list