<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt">I think I want to blend 50/50, so I could set the opacity accordingly in a callback initiated by a StartRender event?<br><br>I have played around with vtkImageStack; I seemed to get only the first (or last) image of the stack or (with transparency) all images blended together... I want one image of the stack blended with another (2d) image. Secondly, I thought creating 100 actors and adding them to a stack was quite slow.<br><div><span><br></span></div><div style="display: block;" class="yahoo_quoted"> <br> <br> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> On
Thursday, January 16, 2014 4:58:53 PM, David Gobbi <david.gobbi@gmail.com> wrote:<br> </font> </div> <div class="y_msg_container">On Thu, Jan 16, 2014 at 2:45 PM, Maarten Beek <<a shape="rect" ymailto="mailto:beekmaarten@yahoo.com" href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>> wrote:<br clear="none">> vtkImageActor::HasTranslucentPolygonalGeometry() seems to want image data of<br clear="none">> type unsigned char and 2 or 4 components in order to do transparency. I'm<br clear="none">> using vtkImageShiftScale to get unsigned char and am working on an algorithm<br clear="none">> to add an alpha component to my one component tiff data. Curious if this<br clear="none">> does the trick.<br clear="none"><br clear="none">I strongly suggest that you use vtkImageSliceMapper and vtkImageSlice<br clear="none">to display your images instead of using vtkImageActor.<br clear="none"><br clear="none">> I can understand
the order is important if one of the actor is opaque, but<br clear="none">> why would this still be important when both are 50% transparent.<br clear="none"><br clear="none">That's not how alpha-blending works. If both images are 50%, then the<br clear="none">frontmost image is displayed at 50%, and the second image gets 25%,<br clear="none">and the background gets the remaining 25%. That's how translucency<br clear="none">works, both in real-life and in computer graphics.<br clear="none"><br clear="none">If you want to blend images 50/50, then the frontmost image should have<br clear="none">50% opacity and the backmost image should have 100% opacity.<br clear="none"><br clear="none">> In my app the loading of each image is initiated through a button. I would<br clear="none">> like to create an app which is independent of the order in which the user<br clear="none">> clicks these buttons.<br clear="none"><br clear="none">Order is
crucial. That's why I recommend that you use vtkImageStack.<br clear="none">It makes it possible to explicitly set the layer number for each image.<br clear="none"><br clear="none"> - David<div class="yqt7424554687" id="yqtfd66538"><br clear="none"><br clear="none"><br clear="none">> On Thursday, January 16, 2014 3:25:11 PM, David Gobbi<br clear="none">> <<a shape="rect" ymailto="mailto:david.gobbi@gmail.com" href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>> wrote:<br clear="none">> Are you using vtk-master (or perhaps a vtk 6.1 release candidate)?<br clear="none">> The TIFF reader had a serious multi-frame bug in older versions.<br clear="none">><br clear="none">> First, note that the vtkTIFFReader doesn't just give you the raw data<br clear="none">> from the files, it seems to pass it through a lookup table sometimes.<br clear="none">> And I'm not sure exactly how it deals with alpha, and to be
honest,<br clear="none">> I wouldn't trust it.<br clear="none">><br clear="none">> I'm really not sure what you mean when you say "The order of adding<br clear="none">> the actors to the renderer matters, but I try to avoid this by using<br clear="none">> transparency." The order in which you add images is _crucial_ when<br clear="none">> you are using transparency.<br clear="none">><br clear="none">> Are you using the vtkImageStack? It's a class that is designed<br clear="none">> specifically to handle layered rendering of images.<br clear="none">><br clear="none">> David<br clear="none">><br clear="none">><br clear="none">><br clear="none">> On Thu, Jan 16, 2014 at 12:40 PM, Maarten Beek <<a shape="rect" ymailto="mailto:beekmaarten@yahoo.com" href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>><br clear="none">> wrote:<br clear="none">>> Hi David,<br
clear="none">>><br clear="none">>> Is it possible to show all images in a multi-paged tiff transparently?<br clear="none">>><br clear="none">>> Only when I show the 1st image (page), I see a 2nd 2d image (both are<br clear="none">>> transparent).<br clear="none">>> As soon as I move to another tiff image (page), the 2d image disappears.<br clear="none">>> It<br clear="none">>> returns when I move back to the 1st tiff page.<br clear="none">>><br clear="none">>> The multi-paged tiff is one component, and I am thinking of an algorithm<br clear="none">>> to<br clear="none">>> add an alpha component, but can hardly believe this would be required...<br clear="none">>><br clear="none">>> The order of adding the actors to the renderer matters, but I try to avoid<br clear="none">>> this by using transparency.<br clear="none">>><br clear="none">>> Moving one
image in front of the other by changing its z-coordinate using<br clear="none">>> vtkImageActor::SetPosition() doesn't help.<br clear="none">>><br clear="none">>> Maarten<br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>> On Friday, November 8, 2013 4:36:06 PM, Maarten Beek<br clear="none">>> <<a shape="rect" ymailto="mailto:beekmaarten@yahoo.com" href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>><br clear="none">>> wrote:<br clear="none">>> Hi David,<br clear="none">>><br clear="none">>> Using VTK 6.0.0, sorry ;-)<br clear="none">>><br clear="none">>> Should I send you the tiff file so you can play with it?<br clear="none">>><br clear="none">>> Now I seem to have your attention:<br clear="none">>><br clear="none">>> - How do I display a multi-page tif? I don't seem to see the different<br
clear="none">>> images using a vtkImageSlice.<br clear="none">>><br clear="none">>> - What would be good values for the window and level parameters? I am<br clear="none">>> using<br clear="none">>> window = range[1]-range[0] and level = 0.5*(range[0]+range[1]) which works<br clear="none">>> ok for this multi-page tif, but gets me nowhere when I try to display a<br clear="none">>> drr.<br clear="none">>><br clear="none">>> Thanks - Maarten<br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>> On Friday, November 8, 2013 4:23:23 PM, David Gobbi<br clear="none">>> <<a shape="rect" ymailto="mailto:david.gobbi@gmail.com" href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>><br clear="none">>> wrote:<br clear="none">>> Hi Maarten,<br clear="none">>><br clear="none">>>
Which version of VTK are you using? I believe that this bug has been<br clear="none">>> fixed in the master branch by a commits in the following topic merge:<br clear="none">>> <a shape="rect" href="http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=7e3d5270" target="_blank">http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=7e3d5270</a><br clear="none">>><br clear="none">>> It was not fixed in time for VTK 5.10, however.<br clear="none">>><br clear="none">>> David<br clear="none">>><br clear="none">>><br clear="none">>> On Fri, Nov 8, 2013 at 2:12 PM, Maarten Beek <<a shape="rect" ymailto="mailto:beekmaarten@yahoo.com" href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>><br clear="none">>> wrote:<br clear="none">>>> Hi all,<br clear="none">>>><br clear="none">>>> vtkTIFFReader crashed for me while loading a multi-paged tiff file.<br
clear="none">>>><br clear="none">>>> The crash occured in vtkTIFFReader::ReadGenericImage(), because<br clear="none">>>> this->OutputExtent was not set (still NULL).<br clear="none">>>> The scalar type for the image I was loading was unsigned short, so it<br clear="none">>>> happened at line 1368.<br clear="none">>>><br clear="none">>>> I changed void vtkTIFFReader::ReadVolume(void* buffer) into void<br clear="none">>>> vtkTIFFReader::ReadVolume(void* buffer, int outExt[6]) and added the line<br clear="none">>>> this->outputExtent = outExt.<br clear="none">>>><br clear="none">>>> This solved my crash.<br clear="none">>>> I am not sure I am on to something, but thought to let you know.<br clear="none">>>><br clear="none">>>> Maarten<br clear="none">><br clear="none">><br clear="none"></div><br><br></div> </div> </div>
</div> </div></body></html>