Reading a .Nrrd file having 3 dimenisions (X,Y,numSlice) and visualizing them in a sequence.

Hello, I am just beginning to write code using ITK and have been wondering how to read .Nrrd files. So far I have written this code :

  1. I am not sure how to visualize the 2D slice data that I have stored in the img.
  2. Is there a simpler way to read .nrrd files and visualize them ?

You seem to have correctly read the image. ITK does not do visualization, just reading/processing/writing. For a quick check, you could do std::cout<<img;.

For visualizations, ITK-SNAP (simpler, quicker) or 3D Slicer (more powerful, more complicated).

Thank you for the prompt response, Dzenanz. On another note is it possible to utilize VTK for visualization of these files ? I came across the class vtkNrrdReader, but unfortunately I couldnā€™t find any examples.

Yes, VTK is frequently used to visualize images and other things. Both ITK-SNAP and 3D Slicer use VTK for visualization. Here are some examples.

1 Like

Thanks Dzenan for your help, meanwhile I was able to write a program to visualize the .nrrd files. But I am getting the following error when I try to build it :

|Error|C2440|ā€˜function-style-castā€™: cannot convert from ā€˜initializer listā€™ to ā€˜vtkSmartPointervtkImageMapper3Dā€™

I have attached the file along.
HelloInsight.cpp (5.1 KB)

I was able to solve the problem by replacing actor->GetMapper->SetInputConnection(color->GetOutputPort()). Anyway, thank you for your help.

1 Like