View Issue Details

IDProjectCategoryView StatusLast Update
0003363Slicer4Core: Base Codepublic2014-03-06 10:17
Reporterlassoan Assigned Tomillerjv  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version 
Target VersionSlicer 4.4.0Fixed in VersionSlicer 4.4.0 
Summary0003363: Vector fields cannot be read from nrrd files
Description

When a vector field (3D array of 3-component vectors) is loaded from a nrrd (or nhdr) file then an empty volume is created.

In contrast, the same content is loaded correctly from mha (or mhd) file.

The problem is fully reproducible with the attached file.

TagsNo tags attached.

Activities

2013-09-03 07:09

 

SmallDefField.nrrd (58,599 bytes)

2013-09-03 07:09

 

SmallDefField.mha (51,506 bytes)

2013-09-03 07:10

 

SmallDefField.vti (58,817 bytes)
lassoan

lassoan

2013-09-03 07:10

developer   ~0009829

By the way, loading of vector fields doesn't work for vti format either.

pieper

pieper

2013-09-03 09:01

administrator   ~0009834

Probably the transform is being read by ITK's transform IO classes so it doesn't support the same types as the image IO classes.

I've assigned this to Alex because we've been talking about having him take on a lot of the non-linear transform related issues now that diffusion is in good shape.

alexy

alexy

2013-09-22 10:00

developer   ~0010040

The factory mechanism in vtkSlicerVolumesLogic treats vector volume as a DTI volume currently. If I change the order of creation of the factories, it then reads DTI volume as vectors. I need Jim's help in figuring out the factory logic, since he is the original author. Re-targeting to future release.

millerjv

millerjv

2013-09-23 10:35

developer   ~0010051

When I load SmallDefField.nnrd, it gets loaded as a VectorVolumeNode. Printing out the details, it contains both scalars and vectors.

ID: vtkMRMLVectorVolumeNode3
Indent: 0
Name: SmallDefField_2
Description: (none)
SingletonTag: (none)
HideFromEditors: 0
Selectable: 1
Selected: 0
Attributes:
LabelMap:0
space:left-posterior-superior
displayNodeRef="vtkMRMLVectorVolumeDisplayNode3"
storageNodeRef="vtkMRMLNRRDStorageNode6"
TransformNodeID: (none)
Debug: Off
Modified Time: 1649777
Reference Count: 1
Registered Events: (none)
Name = (none)
RestoreSelectionState = 0
StorageNodeIDs[0]: vtkMRMLNRRDStorageNode6
DisplayNodeIDs[0]: vtkMRMLVectorVolumeDisplayNode3
IJKToRASDirections:
-1 0 0
0 -1 0
0 0 1

Origin: 25.67 102.917 129.554
Spacing: 0.78125 0.78126 4
ImageData:
Debug: Off
Modified Time: 1661081
Reference Count: 2
Registered Events:
Registered Observers:
vtkObserver (0x7f9040b0d9c0)
Event: 33
EventName: ModifiedEvent
Command: 0x7f9040b7ad40
Priority: 0
Tag: 2
vtkObserver (0x7f9040b66770)
Event: 2
EventName: DeleteEvent
Command: 0x7f9040b113d0
Priority: 0
Tag: 3
vtkObserver (0x7f9040b7ac00)
Event: 33
EventName: ModifiedEvent
Command: 0x7f9040b113d0
Priority: 0
Tag: 4
vtkObserver (0x7f9040be7020)
Event: 2
EventName: DeleteEvent
Command: 0x7f9040b7ad40
Priority: 0
Tag: 1
Source: (none)
Information: 0x7f903bc00740
Data Released: False
Global Release Data: Off
UpdateTime: 1650804
Release Data: Off
UpdateExtent: Initialized
UpdateExtent: 0, 20, 10, 11, 0, 10
CombinedUpdateExtent: 0, -1, 0, -1, 0, -1
WholeExtent: 0, 20, 0, 20, 0, 10
ExtentTranslator: (0x7f903fb79ac0)
RequestExactExtent: Off
Field Data:
Debug: Off
Modified Time: 1650778
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Number Of Points: 4851
Number Of Cells: 4000
Cell Data:
Debug: Off
Modified Time: 1650786
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 1 )
Pass Through Flags: ( 1 1 1 1 1 1 1 1 )
Scalars: (none)
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
EdgeFlag: (none)
Point Data:
Debug: Off
Modified Time: 1661081
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 2
Array 0 name = NRRDImage
Array 1 name = ImageScalars
Number Of Components: 4
Number Of Tuples: 4851
Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 1 )
Pass Through Flags: ( 1 1 1 1 1 1 1 1 )
Scalars:
Debug: Off
Modified Time: 1661078
Reference Count: 1
Registered Events: (none)
Name: ImageScalars
Data type: float
Size: 4851
MaxId: 4850
NumberOfComponents: 1
Information: 0x7f9040d09bc0
Debug: Off
Modified Time: 1665574
Reference Count: 1
Registered Events: (none)
PER_COMPONENT: vtkInformationVector(0x7f9040d1ed60)
Name: ImageScalars
Number Of Components: 1
Number Of Tuples: 4851
Size: 4851
MaxId: 4850
LookupTable: (none)
Array: 0x7f903b465600
Vectors:
Debug: Off
Modified Time: 1650566
Reference Count: 2
Registered Events: (none)
Name: NRRDImage
Data type: float
Size: 14553
MaxId: 14552
NumberOfComponents: 3
Information: 0
Name: NRRDImage
Number Of Components: 3
Number Of Tuples: 4851
Size: 14553
MaxId: 14552
LookupTable: (none)
Array: 0x7f903b415c00
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
EdgeFlag: (none)
Bounds:
Xmin,Xmax: (0, 20)
Ymin,Ymax: (0, 20)
Zmin,Zmax: (0, 10)
Compute Time: 0
ScalarType: 10
NumberOfScalarComponents: 1
Spacing: (1, 1, 1)
Origin: (0, 0, 0)
Dimensions: (21, 21, 11)
Increments: (0, 0, 0)
Extent: (0, 20, 0, 20, 0, 10)
MeasurementFrameMatrix:
1 0 0
0 1 0
0 0 1

Order: -1

alexy

alexy

2013-09-23 13:11

developer   ~0010069

Another way to reproduce it:
I created a vector field using Demons registration and saved it in .nrrd file.
When I read it back I see junk in the probe module.

Reassigning to Jim since he is looking into it.

lassoan

lassoan

2013-09-23 13:39

developer   ~0010070

Note the differences in the vtkMRMLVectorVolumeNode created from mha and nrrd:

In case of mha files loading (correct behavior):

Point Data:
  Number Of Arrays: 1
  Array 0 name = ImageScalars
  Number Of Components: 3
  Scalars: 
    Name: ImageScalars
    Number Of Components: 3
  Vectors: (none)
NumberOfScalarComponents: 3

In case of nrrd files loading (wrong behavior):

Point Data:
  Number Of Arrays: 2
  Array 0 name = NRRDImage
  Array 1 name = ImageScalars
  Number Of Components: 4
  Scalars: 
    Name: ImageScalars
    Number Of Components: 1
  Vectors: 
    Name: NRRDImage
    Data type: float
    Name: NRRDImage
    Number Of Components: 3
NumberOfScalarComponents: 1

It seems that a garbage "NRRDImage" array is created when importing the data from NRRD. This array has only one component and it has incorrect values (some random values in a smaller rectangular region; all zeros outside).

millerjv

millerjv

2013-09-23 13:45

developer   ~0010071

The mha loads the data as scalars. Is this what you wanted? Or do you really want vectors?

For reference, the Multivolume code loads time series data as multi component scalars.

lassoan

lassoan

2013-09-23 14:00

developer   ~0010072

I would prefer to have the data imported into a format that Slicer can deal with.

Slicer seems to be able to handle vtkMRMLVectorVolumeNodes with 3-component scalar image data quite well: you can probe them, you can visualize them correctly. RGB color images are loaded into this format as well (from jpg, png, ...).

So, I would prefer if nrrd volumes with 3 scalar components would be loaded into this same format.

millerjv

millerjv

2013-09-25 04:09

developer   ~0010088

SmallDefField.nrrd has a "nrrd kind" of "vector".

If I change the "nrrd kind" to "list", then the data loads properly into Slicer and can be visualized (assuming this deformation field looks like a gradient fill). Interestingly, while the data loads into a MRMLVectorVolumeNode, the data is actually stored in the Scalars as 3 component scalars.

millerjv

millerjv

2013-10-09 03:45

developer   ~0010157

Fixed in r22607.

Unified Slicer's treatment of vector images in vtkNRRDReader. Previously, 3-vector images were stored on the Vectors of the underlying ImageData. All other length vectors were stored as multi-component Scalars on the ImageData.

This patch always assigns vector data as multi-component Scalars on the ImageData.

jcfr

jcfr

2013-10-26 19:14

administrator   ~0010228

Backported to Slicer-4-3 branch as r22643
See http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=22643

lassoan

lassoan

2013-12-02 10:43

developer   ~0010394

Thank you. Tested on Slicer 4.3.1-2013-11-29 (Win64) and it works correctly.

Issue History

Date Modified Username Field Change
2013-09-03 07:09 lassoan New Issue
2013-09-03 07:09 lassoan Status new => assigned
2013-09-03 07:09 lassoan Assigned To => jcfr
2013-09-03 07:09 lassoan File Added: SmallDefField.nrrd
2013-09-03 07:09 lassoan File Added: SmallDefField.mha
2013-09-03 07:10 lassoan File Added: SmallDefField.vti
2013-09-03 07:10 lassoan Note Added: 0009829
2013-09-03 07:17 jcfr Target Version => Slicer 4.3.1
2013-09-03 09:01 pieper Note Added: 0009834
2013-09-03 09:01 pieper Assigned To jcfr => alexy
2013-09-22 10:00 alexy Note Added: 0010040
2013-09-22 10:00 alexy Target Version Slicer 4.3.1 => Slicer 4.3.2
2013-09-23 10:35 millerjv Note Added: 0010051
2013-09-23 13:11 alexy Note Added: 0010069
2013-09-23 13:11 alexy Assigned To alexy => millerjv
2013-09-23 13:39 lassoan Note Added: 0010070
2013-09-23 13:45 millerjv Note Added: 0010071
2013-09-23 14:00 lassoan Note Added: 0010072
2013-09-25 04:09 millerjv Note Added: 0010088
2013-10-09 03:45 millerjv Note Added: 0010157
2013-10-09 03:45 millerjv Status assigned => resolved
2013-10-09 03:45 millerjv Resolution open => fixed
2013-10-26 19:14 jcfr Note Added: 0010228
2013-10-26 19:14 jcfr Fixed in Version => Slicer 4.3.2
2013-12-02 10:43 lassoan Note Added: 0010394
2013-12-02 10:43 lassoan Status resolved => closed
2014-03-06 10:16 nicole Target Version Slicer 4.3.2 => Slicer 4.4.0
2014-03-06 10:17 nicole Fixed in Version Slicer 4.3.2 => Slicer 4.4.0