[vtk-developers] A NIFTI Reader for VTK

David Gobbi david.gobbi at gmail.com
Tue Feb 19 13:38:28 EST 2013


For this VTK NIFTI reader, compression is supported by
reading/writing the file directly via zlib.  For reading it was
trivial, because zlib can transparently read uncompressed
files. Unfortunately VTK has an old version of zlib that
doesn't support transparent writing of uncompressed files,
so the writer needs an "if" to write via zlib if compressed,
or via fwrite if not compressed.  Once VTK adopts a newer
zlib, the fwrite code can be removed.
http://review.source.kitware.com/#/t/2160/

 - David



On Tue, Feb 19, 2013 at 11:20 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> I only asked, because ITK does use the library. Hans Johnson from
> UIowa is active in the nifti community. I know is supports
> compression. I'm not sure what else it provides. I've cc'ed Hans
>
> On Tue, Feb 19, 2013 at 1:01 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>> No, I didn't.  The NIFTI library doesn't provide very much in terms
>> of functionality (NIFTI is a very simple file format).  About the only
>> thing I would have from it would be the function to byte-swap the
>> header.  So I didn't see the point of bringing another third-party
>> library into VTK.  Not for a file format that is just a fixed-format
>> header followed by raw data.
>>
>>  - David
>>
>> On Tue, Feb 19, 2013 at 10:49 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>>> It seems you did not use the nifti library?
>>>
>>> On Tue, Feb 19, 2013 at 12:20 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>>>> Hi All,
>>>>
>>>> I've pushed a topic with a reader/writer for the NIFTI file format:
>>>> http://review.source.kitware.com/#/t/2160/
>>>>
>>>> Overall, it's made to be similar to the ITK NIFTI-IO, so it is
>>>> quite different from the paraview NIFTI classes.  The main
>>>> thing is how it deals with dimensions:
>>>>
>>>> 1) It does not filter (i.e. re-order) the x,y,z dimensions.  Instead,
>>>> it provides a matrix to to convert the raw image coordinates
>>>> into NIFTI coordinates (RAS coordinates).  Actually it provides
>>>> two such matrices: one for the NIFTI qform, and another for
>>>> the NIFTI sform.
>>>>
>>>> 2) Multi-dimensional NIFTI images are read as multi-component
>>>> VTK images.  So a NIFTI vector image becomes a VTK image
>>>> with 3 components.  A NIFTI tensor image becomes a VTK image
>>>> with 6 (or 9) components.  It's up to the application to determine
>>>> the intent of the data.
>>>>
>>>> 3) The time dimension is ignored unless a specific flag
>>>> "TimeAsVector" is set.  If that flag is set, then subsequent
>>>> time points are read into subsequent scalar components. In other
>>>> words, a time image becomes a vector image.  This is a trick
>>>> that I've been using for years to deal with 4D images in VTK.
>>>>
>>>> 4) There isn't much support for NIFTI metadata yet.
>>>>
>>>> I'd be glad to hear feedback from anyone who is familiar with
>>>> NIFTI.
>>>>
>>>>  - David
>>>> _______________________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>>>
>>>
>>>
>>>
>>> --
>>> Unpaid intern in BillsBasement at noware dot com
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com



More information about the vtk-developers mailing list