Issue identified and summarized by Claude while working on ImagingDataCommons/idc-index-data#170
Volume.copy() does not pass channels to the constructor, so it fails for any volume with channel dimensions. match_geometry() calls copy() when the geometries already match, so a SEG volume that is already on its source image's grid cannot be matched to it.
import numpy as np
import highdicom as hd
vol = hd.Volume(
array=np.zeros((2, 3, 3, 2), dtype=np.uint8),
affine=np.eye(4),
coordinate_system="PATIENT",
channels={"SegmentNumber": [1, 2]},
)
vol.copy()
ValueError: Number of items in the 'channels' parameter (0) does not match the number of channel dimensions in the array (1).
highdicom 0.28.1. Workaround: skip match_geometry() when geometry_equal() is true.
Issue identified and summarized by Claude while working on ImagingDataCommons/idc-index-data#170
Volume.copy()does not passchannelsto the constructor, so it fails for any volume with channel dimensions.match_geometry()callscopy()when the geometries already match, so a SEG volume that is already on its source image's grid cannot be matched to it.highdicom 0.28.1. Workaround: skip
match_geometry()whengeometry_equal()is true.