Multi-raw image loading using RawImageGuess extension

Can someone help us to import multi-raw images?
Our system is remaining each slice image.
Ex) 240 Slice = Slice0001,0002,0003, 0004…

As I confirm the RawImageGuess extension module, only supports one raw image.
We really need this function. please help us.

Thanks to the 3D Slicer development team.

You mean, you have a sequence of raw images? If you know the xyz dimensions and voxel spacing, and data type (char, int, short etc), you can write a simple NRRD header to describe the data. I think something like this probably work. You need to replace the type and sizes with correct value.

type: uchar 
dimension: 3
sizes: 1024 1024 240
encoding: raw
datafile: ./Slice0001

1 Like

Thanks muratmaga,

Yes it mean, i have a sequence of raw images.
I know xyz dimensions and voxel spacing. but how to create the NRRD header?
Could you please let me know?

I really need this method.

It is a simple text file that gets written. You can see the specification here.

See the section specifically 3. Detached Headers with “data file:”

1 Like

Hi Muratmaga.

Really thanks for your quick reply.
I tried to make nrrd to refer your reply.
But when i load the nrrd file, following error occurs.

Error: Loading D:/2022.09.29 CT/slice.nrrd - Failed to read node slice_2 (vtkMRMLSequenceNode1) from filename=‘D:/2022.09.29 CT/slice.nrrd’

^ vtkMRMLVolumeArchetypeStorageNode::ReadDataInternal: Cannot read file as a volume of type Volume [fullName = D:/2022.09.29 CT/slice.nrrd]: FileFormatError. Number of files listed in the node = 0. File reader says it was able to read 1 files. File reader used the archetype file name of D:/2022.09.29 CT/slice.nrrd [reader 0th file name = D:/2022.09.29 CT/slice.nrrd].

[NRRD Format]
type: uchar
dimension: 3
sizes: 1024 1024 240
encoding: raw
datafile: ./slice0000

Nrrd file is included in the same raw sequence folder.
File name : slice0000 , slice0001 , slice0002 ,slice0003 ,slice0004

Is it have way to correct importing nrrd file?
If this code is wrong, please make sample code for me?

I really helpful for your advice.

To be perfectly honest, I never tried building a nrrd header from sequence of images, but I know it is doable. Looking at the description of detached header more carefully, you may have to use the keyword LIST or define a filename formatting (min, max, increase). Try adding LIST right after data file or type

datafile: "Slice%04d 0 max_number_slices 1

3. Detached Headers with “data file:”

Detached headers allow data stored in one or more separate files, with or without headers of another format, to be accessed by a NRRD header, leaving the original file(s) intact. The line skip and byte skip fields are especially useful for these cases. Detached headers are also very useful in situations where very large amounts of data are to be read or written with direct IO, a very fast method of IO in which the device driver transfers data directly between blocks on disk and user-space memory (nrrd currently supports direct IO on SGIs, via the air library). Direct IO requires special alignment between the data segment beginning and the block boundaries on disk, which makes using attached headers rather inconvenient. Detached headers are also the simplest way to deal with NRRD readers which do not support the optional compressed encodings, since a stand-alone program (such as “gzip/gunzip” or “bzip2/bunzip2”) will be able to process the separate data file.

There is one new field specification which is required in detached headers, using the “data file” identifier. This field specification can take one of three possible forms (the second and third were copied from the MetaImage format).

  1. data file: <filename>
  2. data file: <format> <min> <max> <step> [<subdim>]
  3. data file: LIST [<subdim>]
1 Like

@muratmaga what you described works well - see

1 Like

Really Thanks for your support.