<div dir="ltr"><div>Hi Kyle,</div><div><br></div><div>The vtkImageBlend class requires the images to have identical sampling.</div><div>It's possible to get it to overlay an image that is smaller than the base</div><div>image, but to do so you need the overlay image to have an "Extent" that</div><div>starts at a value greater than zero. The Extent of an image can be shifted</div><div>around with the vtkImageChangeInformation filter. All in all, it is a huge</div><div>hassle, and sometimes it's easier to use vtkImageReslice to resample the</div><div>overlay to match the base image.</div><div><br></div><div>For all DICOM-viewer apps that I've written recently, I've taken a totally</div><div>different approach, and used the VTK image rendering classes that I</div><div>contributed a few years ago:</div><a href="https://www.vtk.org/Wiki/VTK/Image_Rendering_Classes">https://www.vtk.org/Wiki/VTK/Image_Rendering_Classes</a><div><br></div><div>Some examples are here (they're not great examples, but they exist):</div><div><a href="https://gitlab.kitware.com/vtk/vtk/tree/master/Rendering/Image/Testing/Cxx">https://gitlab.kitware.com/vtk/vtk/tree/master/Rendering/Image/Testing/Cxx</a><div class="gmail_extra"><a href="https://github.com/dgobbi/vtk-dicom/blob/master/Examples/TestDICOMDisplay.cxx">https://github.com/dgobbi/vtk-dicom/blob/master/Examples/TestDICOMDisplay.cxx</a><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">If you don't want to go that far, you might consider using the</div><div class="gmail_extra">vtkImageResliceToColors class to resolve the background issue.</div><div class="gmail_extra">This is a subclass of vtkImageReslice that has a SetLookupTable() method.</div><div class="gmail_extra">It combines reslicing and color mapping into a single operation, so that</div><div class="gmail_extra">when you call SetBackgroundColor() you set the actual RGBA color</div><div class="gmail_extra">directly.</div><div class="gmail_extra"><br></div><div class="gmail_extra"> - David</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 16, 2018 at 3:19 PM, Kyle Nethery-Pavelchak <span dir="ltr"><<a href="mailto:wizardanim2000@gmail.com" target="_blank">wizardanim2000@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi all -<br>
<br>
My company is using VTK to render overlaid DICOM images to a screen.<br>
All of the images in question are single channel intensity mapped<br>
images encoded in a ushort buffer.<br>
<br>
Quick overview of how data is built:<br>
- vtkImageReslice is hooked into vtkImageMapToWindowLevelColors object.<br>
- We add a custom lookup table to the window/level colors object.<br>
- We connect the w/l colors object to a vtkImageMapper.<br>
- We connect the image mapper to a Actor2D.<br>
- We then use a vtkImageBlend class and set input connections to two<br>
channels from the Actor2D generated in the above steps.<br>
<br>
For each Actor2D object rendered to the screen, we can control default<br>
values of pixels on the screen by accessing values within the lookup<br>
table. However, for pixels outside the extent of the data being<br>
drawn, the value appears to always be (0,0,0,1).<br>
<br>
We run into issues when considering blending of two images. We need<br>
the background image (if larger than the overlay image) to be present<br>
outside the extents of the overlay image.<br>
<br>
I see / have tried various API which seem like they should work - ie:<br>
vtkImageReslice::<wbr>SetBackgroundColor, setting default value in lookup<br>
table, reimplementing the vtkImageBlend class to attempt to access<br>
these background pixels.<br>
<br>
One strange behavior I've noticed, is in the 'SetBackgroundColor(...)'<br>
function on the reslicer, a value of (x, 0, 0, 0) sets the intensity<br>
value of the background pixels - i can achieve a white background if i<br>
set 'x' to be the highest value in our lookup table. However, the BG<br>
channels remain 0 and A remains 1 even if i specify 0 in the function.<br>
I would assume this is because the DICOM image is a single channel<br>
image, and VTK is generating the background with the same format ..?<br>
<br>
I am wondering if anyone has seen/experienced this before, or, knows<br>
how to work around this kind of issue.<br>
<br>
thanks<br></blockquote></div></div></div></div>