dgobbi / vtk-dicom

A set of classes for using DICOM in VTK.
BSD 3-Clause "New" or "Revised" License
258 stars 94 forks source link

Pixel Padding Value #128

Open dgobbi opened 7 years ago

dgobbi commented 7 years ago

The PixelPaddingValue and related attributes (PixelPaddingRangeLimit, FloatPixelPaddingValue, DoubleFloatPixelPaddingValue) can be used to mask data during display or filtering operations. This mask must be used when performing image registration.

The PixelPaddingValue mask is meant to be applied before the modality LUT, therefore it might be reasonable for the reader to generate the mask. The alternative would be to have a dedicated filter for this, but this is only possible if the the reader provides the stored values as output (i.e. if the reader doesn't apply the modality LUT).

dgobbi commented 7 years ago

A GetMaskOutput() method could be added to the reader. A stencil data object cannot be used, because the reader uses multi-component output data for 4D data sets, and stencils cannot be multi-component.

The modality that most often uses PixelPaddingValue is CT (though it isn't present in all CT datasets, even though nearly all CT needs masking -- perhaps I could use the reconstruction diameter for when PixelPaddingValue is missing). When the CT volume is rectified, the same would be needed for the mask. In fact, the mask could be rectified first, and then used to generate a stencil for the operation on the volume.

dgobbi commented 6 years ago

This next comment might be beyond the scope of vtkDICOM iteself. When an image is interpolated (e.g. during display) the padding should ideally be excluded. For high-order kernels (cubic, sinc, etc) the discontinuity between image pixels and padding pixels causes a bright/dark fringe due to ringing.

Even if a mask is applied during interpolation, the "inner" half of the fringe will still be visible. So a full solution would require the following: 1) extrapolate the image into the padding, e.g. each padding pixel would be set to the average of all adjacent image pixels (recurse as needed), 2) apply mask during interpolation.

Masking during interpolation might not always be possible.