HI-SPEED Java Examples
1. Data and Matrix Manipulation
2. NIFTI Data Handling
Specifications:
a. HI-SPEED can handle Nifti data format up to the max dimension, which is 7.
b. Supported data types: short, int, long, float, and double.
c. HI-SPEED is able to take in data with ".nii" or ".nii.gz" extension and write out in ".nii" extension.
A. Loading Data and print out header information:
//remember to include the following statement "import cgk.dataformats.*;" in your Java file.
//sample code for reading and printing the header information of a sample data set from the Data Format Working Group of Nifti.
String str = "/data/avg152T1_RL_nifti.nii.gz";
NiftiReader nr = new NiftiReader(str);
nr.printHeader();
//The data contains numbers with 8-bit short and has 3 dimensions.
// To load the data, we need explicit casts because Java is a strong typed language.
NiftiDataObject ndo = nr.getNiftiDataObject();
short[][][] data = (short[][][]) ndo.getData();
B. Modifying Data
C. Storing Data