InsightSoftwareConsortium / InsightSoftwareConsortium/ITK
Inconsistent read from `.mha` vector image
- Dominant language
- C++
- Stars
- 1.7k
- Forks
- 748
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 64
Description
### Description
Behavior is observed where vector pixel data is read inconsistently from a small `.mha` data file.
### Steps to Reproduce
1. Download the data file from the ITKUltrasound data folder on Girder: [rf_voltage_15_freq_0005000000_2017-5-31_12-36-44_ReferenceSpectrum_side_lines_03_fft1d_size_128.mha](https://data.kitware.com/#item/593d92148d777f16d01e4f11). The data file is a 3D image with a single voxel that is a 31-channel vector.
2. Repeatedly read in the 31-channel vector image in Python and access the 29th or 30th channel
```py
>>> import itk
>>> pixel_type = itk.VariableLengthVector[itk.F]
>>> image = itk.imread(r'path/to/rf_voltage_15_freq_0005000000_2017-5-31_12-36-44_ReferenceSpectrum_side_lines_03_fft1d_size_128.mha',pixel_type=pixel_type)
>>> image.GetPixel(0).GetElement(29)
1.2316740878152266e-39
>>> image = itk.imread(r'path/to/rf_voltage_15_freq_0005000000_2017-5-31_12-36-44_ReferenceSpectrum_side_lines_03_fft1d_size_128.mha',pixel_type=pixel_type)
>>> image.GetPixel(0).GetElement(29)
1.6303663969778794e+20
>>> image = itk.imread(r'path/to/rf_voltage_15_freq_0005000000_2017-5-31_12-36-44_ReferenceSpectrum_side_lines_03_fft1d_size_128.mha',pixel_type=pixel_type)
>>> image.GetPixel(0).GetElement(29)
1.6303663969778794e+20
>>> image = itk.imread(r'path/to/rf_voltage_15_freq_0005000000_2017-5-31_12-36-44_ReferenceSpectrum_side_lines_03_fft1d_size_128.mha',pixel_type=pixel_type)
>>> image.GetPixel(0).GetElement(29)
1.2316740878152266e-39
```
### Expected behavior
Pixel output value is consistent
### Actual behavior
Channel 29 alternates between 1.2316740878152266e-39 and 1.6303663969778794e+20
Channel 30 alternates between 2.1019476964872256e-44 and 0.15648820996284485
### Reproducibility
Alternates evenly, approximately 50%
### Versions
ITK 5.3rc03
### Environment
Windows, Python 3.8.5
### Additional Information
Contributor guide
Assessment
This issue has not been assessed yet.