Git Product home page Git Product logo

niftijio's Introduction

niftijio

This project is a Java library for reading and writing NIfTI image volumes. This includes support for header metadata, various datatypes, and multichannel volumes. When a volume is read from a file, the image intensities are stored in a four-dimensional double array. The array indices match the order in the 'dim' array of the header.

A jar can be built using Maven by executing 'mvn package'.

The file format specification can be found here:

http://nifti.nimh.nih.gov/nifti-1

The code for reading the header was derived from the following implementation:

http://niftilib.sourceforge.net

The code for little-endian streams is provided by Roedy Green:

http://mindprod.com/jgloss/endian.html

This is released under the MIT license. Any comments can be directed to Ryan Cabeen at [email protected]

niftijio's People

Contributors

cabeen avatar enet4 avatar ericbarnhill avatar ghazi-bouabene avatar plooney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

niftijio's Issues

supporting nifti-2

Hi,
I was wondering if the niftijio could support nifti-2 or not?
Best,

supporting more than 4 dimension?

Hi,
thank you very much for such a great library.
I want to use the dimension 5, 6, and 7. I understand it is not possible with this lib.
could I fork your repo and develop?
best,

Exception in reading an extention

Hi @cabeen
I hope you are well, I got an error when I wanted to read a nifti file that had a .json extension. It may be my misunderstanding of the format.

 while (start_addr < (int) ds.vox_offset)
            {
                int[] size_code = new int[2];
                size_code[0] = di.readInt();
                size_code[1] = di.readInt();

                int nb = size_code[0] - NiftiHeader.EXT_KEY_SIZE;
                byte[] eblob = new byte[nb];
                di.readFully(eblob, 0, nb);
                ds.extension_blobs.add(eblob);
                ds.extensions_list.add(size_code);
                start_addr += (size_code[0]);
                if (start_addr > (int) ds.vox_offset)
                    throw new IOException("Error: Data  for extension " + (ds.extensions_list.size())
                            + " appears to overrun start of image data.");
            }

let's assume we have a JSON file (157 bytes) and 8 bytes for extension keys; when it reaches to end; the start_addr is 509, so It starts again and reads the first 8 bytes which may be wrong.
I think if it checks the size of the rest bytes, it could be solved. like this:

if(((int) ds.vox_offset - start_addr)<16)
                    break;

Kind regards,

Publish on Maven Central

Hi Cabeen,

As already mentioned I think your library is very useful for the java medical imaging community.

It would be great if it could be published to Maven central, then we could simply add a dependency instead of having to clone to produce your own jar.
This would make it easily accessible to a wider audience. What do you think ?

Best,
Ghazi

Improving efficiency using 1-d array

Thanks for the great software!

Hi, I created a much improved version (in terms of efficiency) that uses a 1-d array (instead of 4-d) to store the data. Let me know if you want me to send it to you.

Jeremy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.