<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV>Hi guys,</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I'm actually working on a similar filter and should have it finished in a couple of days (depending on how my cold progresses). Basically the image takes as input a vector of input images and produces a single image with the "interesting" voxels from the input images labeled. I can post the filter when finished.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>-Robert</DIV><BR><DIV><DIV>On Oct 17, 2006, at 6:15 PM, Prename Surname wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV>Aha, that would of course also be an idea to do like that. I dont know any of these filters.</DIV> <DIV>So your interresting suggestion is to subclass the </DIV> <DIV>itk::NaryFunctorImageFilter&lt; TInputImage, TOutputImage, TFunction &gt;</DIV> <DIV>so that it accepts 3 input images in the constructor, and then internally does what?<BR><BR> </DIV> <DIV><SPAN class="gmail_quote">2006/10/17, Gaëtan Lehmann &lt;<A href="mailto:gaetan.lehmann@jouy.inra.fr">gaetan.lehmann@jouy.inra.fr</A>&gt;:</SPAN> <BLOCKQUOTE class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Le Tue, 17 Oct 2006 21:18:16 +0200, Prename Surname<BR>&lt;<A href="mailto:bsd.diverse@gmail.com">bsd.diverse@gmail.com </A>&gt; a écrit:<BR><BR>&gt; aha i see...<BR>&gt; Yes, of course i know this is simple, but starting simple is always the<BR>&gt; way<BR>&gt; to go :)<BR><BR>sure<BR><BR>&gt;<BR>&gt; I think maybe you have misunderstood what i want to do. I dont want to <BR>&gt; make<BR>&gt; a RGB image, i just want to combine 3 different binary mask images into a<BR>&gt; single grayscale mask image with values 0,1,2,3 (0=background, 1=gm,<BR>&gt; 2=wm,3=wm)<BR>&gt; If i just manage this i can port it to vtk no problem. <BR>&gt; So i just wanted to create a composite filter to do this for me.<BR>&gt; Do you see what i mean?<BR><BR>Yes, I think :-)<BR>This mean you are sure that the object in an image is never overlapping<BR>with the objects in the other images. Is it the case ? <BR>If yes, you can use ChangeLabelImageFilter to change the value of your<BR>background pixels to 0 (if it's not already the case), and the values of<BR>the foreground pixel to 1 in the first image, 2 in the second one, and 3 <BR>in the last one. Finally, you can add your 3 images with<BR>NaryAddImageFilter to produce the image you want.<BR>It can be quite boring to instantiate 4 filters to do that - perhaps<BR>that's the right time to implement a custom filter based on <BR>NaryFunctorImageFilter :-)<BR><BR>Gaetan<BR><BR>&gt;<BR>&gt; Many regards :)<BR>&gt;<BR>&gt;<BR>&gt; 2006/10/17, Gaëtan Lehmann &lt;<A href="mailto:gaetan.lehmann@jouy.inra.fr">gaetan.lehmann@jouy.inra.fr</A>&gt;:<BR> &gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt; Hi,<BR>&gt;&gt;<BR>&gt;&gt; Most of the time, the simple manipulation like this one can already be<BR>&gt;&gt; done in ITK or VTK, so you shouldn't have to create a new filter to do<BR>&gt;&gt; that :-) <BR>&gt;&gt; However, we are always pleased to see someone motivated to develop some<BR>&gt;&gt; new features for the toolkit, especially if he/she want to contribute<BR>&gt;&gt; that<BR>&gt;&gt; code to the community. I'm pretty sure you'll find something useful to <BR>&gt;&gt; code soon :-)<BR>&gt;&gt;<BR>&gt;&gt; To combine your 3 images, you can use ComposeRGBImageFilter (1), which<BR>&gt;&gt; takes 3 input images and give you a RGB image.<BR>&gt;&gt; However, I'm not sure you can pass the rgb image directly to vtk <BR>&gt;&gt; (perhaps<BR>&gt;&gt; something to code :-)). You'll have to pass the 3 binary images in vtk<BR>&gt;&gt; with ImageToVTKImageFilter, and compose the color image in vtk.<BR>&gt;&gt;<BR>&gt;&gt; Gaetan<BR>&gt;&gt; <BR>&gt;&gt; (1)<BR>&gt;&gt; <A href="http://www.itk.org/Doxygen/html/classitk_1_1ComposeRGBImageFilter.html">http://www.itk.org/Doxygen/html/classitk_1_1ComposeRGBImageFilter.html</A><BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt;<BR> &gt;&gt; Le Tue, 17 Oct 2006 19:56:04 +0200, Prename Surname<BR>&gt;&gt; &lt;<A href="mailto:bsd.diverse@gmail.com">bsd.diverse@gmail.com</A>&gt; a écrit:<BR>&gt;&gt;<BR>&gt;&gt; &gt; Hello.<BR>&gt;&gt; &gt; I am beginning to feel a bit more at home in itk/vtk now. There are <BR>&gt;&gt; &gt; still a<BR>&gt;&gt; &gt; zillion things to learn about it, but its getting a bit better. So<BR>&gt;&gt; now i<BR>&gt;&gt; &gt; have decided that i want to try and make my own filter to get more<BR>&gt;&gt; &gt; acquainted with the whole pipeline approach. <BR>&gt;&gt; &gt;<BR>&gt;&gt; &gt; I have read chapter 13 in the itksoftwareguide, and i have thought<BR>&gt;&gt; about<BR>&gt;&gt; &gt; a<BR>&gt;&gt; &gt; approach to make my filter. I was hoping some of you experts would <BR>&gt;&gt; tell<BR>&gt;&gt; &gt; me<BR>&gt;&gt; &gt; if i am completely off, or if my idea is okay.<BR>&gt;&gt; &gt; My situation is this:<BR>&gt;&gt; &gt; I have a greyscale volume consisting of 182 slices that are 182x218 <BR>&gt;&gt; &gt; pixels<BR>&gt;&gt; &gt; of a brain.<BR>&gt;&gt; &gt; I have a mask of corresponding size with values 0 and 255 for the<BR>&gt;&gt; &gt; positions<BR>&gt;&gt; &gt; of greymatter<BR>&gt;&gt; &gt; I have a mask of corresponding size with values 0 and 255 for the <BR>&gt;&gt; &gt; positions<BR>&gt;&gt; &gt; of whitematter<BR>&gt;&gt; &gt; I have a mask of corresponding size with values 0 and 255 for the<BR>&gt;&gt; &gt; positions<BR>&gt;&gt; &gt; of CSF(brainfluid)<BR>&gt;&gt; &gt; <BR>&gt;&gt; &gt; Basically i want my filter to combine the 3 masks to a single image,<BR>&gt;&gt; so<BR>&gt;&gt; &gt; that<BR>&gt;&gt; &gt; i can visualize this image in vtk with different colors for<BR>&gt;&gt; greymatter, <BR>&gt;&gt; &gt; whitematter and CSF.<BR>&gt;&gt; &gt;<BR>&gt;&gt; &gt;<BR>&gt;&gt; &gt; Making a filter (lets call it masking)that subclasses<BR>&gt;&gt; ImageToImageFilter,<BR>&gt;&gt; &gt; and then takes 2 input images and somehow combining them to a single <BR>&gt;&gt; &gt; image<BR>&gt;&gt; &gt; by just adding them together.<BR>&gt;&gt; &gt;<BR>&gt;&gt; &gt; I then want to make a compositefilter that actually makes a pipeline<BR>&gt;&gt; of<BR>&gt;&gt; 2<BR>&gt;&gt; &gt; masking filters, taking first 2 masks, combining them in the masking <BR>&gt;&gt; &gt; filter,<BR>&gt;&gt; &gt; takes the output of this and combine it with the third mask using<BR>&gt;&gt; again<BR>&gt;&gt; &gt; the<BR>&gt;&gt; &gt; masking filter, and then outputting the final masked image. <BR>&gt;&gt; &gt;<BR>&gt;&gt; &gt; Does this sound  feasible, and more important is this a good approach?<BR>&gt;&gt; &gt; I hope for some feedback.<BR>&gt;&gt; &gt;<BR>&gt;&gt; &gt; Many regards and thank you<BR>&gt;&gt; <BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt; --<BR>&gt;&gt; Gaëtan Lehmann<BR>&gt;&gt; Biologie du Développement et de la Reproduction<BR>&gt;&gt; INRA de Jouy-en-Josas (France)<BR>&gt;&gt; tel: +33 1 34 65 29 66    fax: 01 34 65 29 09 <BR>&gt;&gt; <A href="http://voxel.jouy.inra.fr">http://voxel.jouy.inra.fr</A><BR>&gt;&gt;<BR><BR><BR><BR>--<BR>Gaëtan Lehmann<BR>Biologie du Développement et de la Reproduction<BR>INRA de Jouy-en-Josas (France)<BR>tel: +33 1 34 65 29 66    fax: 01 34 65 29 09 <BR><A href="http://voxel.jouy.inra.fr">http://voxel.jouy.inra.fr</A><BR></BLOCKQUOTE></DIV><BR><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Insight-users mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:Insight-users@itk.org">Insight-users@itk.org</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</A></DIV> </BLOCKQUOTE></DIV><BR></BODY></HTML>