Nrrd Import

posted in: Feature | 0

Minimal NRRD file example to import volume and segmentation data into Specto

Volume Data

version: NRRD0004 or NRRD005
type: Volume data need to be type short
size: Volume size in voxels
space directions: spacing between voxels in particular direction
encoding: raw – no compression supported

MyVoxelData.nrrd


NRRD0004
type: short
dimension: 3
sizes: 512 512 609
encoding: raw
space directions: (0.97656249999999978,0,0) (0,0.97656249999999978,0) (0,0,1.4999999999999996)

#Empty line mark start of binary data
#Voxeldata is saved as short[x*y*z] data array
#for(z) for(y) for(x) writeShort(voxelData)
?.?.?.?.?.?.?.?.?….


Segmentation

version: NRRD0004 or NRRD005
type: Segmentation data must be type unsigned char
dimensions: Segmentation data is 4 dimensions [layers][x][y][z] encoding: raw – no compression supported
sizes: numberOfLayers voxelsX voxelsY voxelsZ – segmentation volume size can be smaller than original
Segmentation_ReferenceImageExtentOffset:= offsetX offsetY offsetZ – voxel offset of segmentation volume in original
Segment{LAYER}_Extent:= xStart xEnd yStart yEnd zStart zEnd – OPTIONAL segmented region for layer inside segmentation data

MySegmentation.seg.nrrd


NRRD0005
type: unsigned char
dimension: 4
sizes: 3 303 329 459
encoding: raw
Segmentation_ReferenceImageExtentOffset:=209 53 150
Segment0_Extent:=1 216 53 328 293 458
Segment1_Extent:=25 302 0 323 0 224
Segment2_Extent:=0 153 133 265 152 280

#Empty line mark start of binary data
#Segmentation data is saved as unsigned short[layer*x*y*z] data array
#for(z) for(y) for(x) for(layers) writeUnsignedChar(segmented ? 1 : 0)
?.?.?.?.?.?.?.?.?….