GithubHelp home page GithubHelp logo

okieraised / gonii Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 0.0 22.55 MB

Standalone NIfTI file parser

License: BSD 3-Clause "New" or "Revised" License

Go 100.00%
medical-imaging nifti-1 nifti-2 nifti-format nifti-gz nifti-images nifti nii

gonii's Introduction

gonii

Standalone, pure golang NIfTI file parser that provide functionalities to read and write NIfTI file format (including NIfTI-1 and NIfTI-2)

** This package is under active development and can be in a broken state. Please use the latest released version **

To install this package, run:

go get github.com/okieraised/gonii

To parse a single NIfTI file:

package main

import (
	"fmt"
	"github.com/okieraised/gonii"
)

func main() {
	filePath := "./test_data/int16.nii.gz"

	// Init new reader with option to keep the header structure after parsing
	rd, err := gonii.NewNiiReader(gonii.WithReadImageFile(filePath), gonii.WithReadRetainHeader(true))
	if err != nil {
		panic(err)
	}

	// Parse the image
	err = rd.Parse()
	if err != nil {
		panic(err)
	}

	// Access the NIfTI image structure
	img := rd.GetNiiData()

	// to see the raw byte data
	fmt.Println(img.Volume[60000:70000])

	// Transform the raw byte slices to a 1-D slice of voxel value in float64
	voxels := rd.GetNiiData().GetVoxels()
	// to see the transformed value as a float64 slice
	fmt.Println(voxels.GetDataset()[60000:70000])
}

TODO

  • Improve NIfTI reader parsing speed for large file size
  • Add support for NIfTI writer to export data as NIfTI-2 format
  • Support overlapping bitmap annotations

gonii's People

Contributors

okieraised avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.