<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body>Gaetan,<BR>
&nbsp;<BR>
Is there an example to show how to map spatial objects to an image? Examples/SpatialObjects/GaussianSpatialObject.cxx only creates the gaussian object, how is it possible to show it in an image?<BR>
<BR>&gt; <BR>&gt; <BR>&gt; Hi,<BR>&gt; <BR>&gt; Have you tried to generate your image with some itk::GaussianSpatialObject <BR>&gt; ?<BR>&gt; <BR>&gt; Regards,<BR>&gt; <BR>&gt; Gaetan<BR>&gt; <BR>&gt; On Mon, 08 Jan 2007 13:25:51 +0100, Christian Marshall Rieck <BR>&gt; &lt;rieck@stud.ntnu.no&gt; wrote:<BR>&gt; <BR>&gt; &gt;&gt; Thanks for the reply, I am NOT avoiding the overlapping -- I just want<BR>&gt; &gt;&gt; the particle-images to be overlapped naturally. That is, at each<BR>&gt; &gt;&gt; overlapping region, the pixel values of one of the particle-images must<BR>&gt; &gt;&gt; overwrite (NOT be added to) the pixel values of the other <BR>&gt; &gt;&gt; particle-image.<BR>&gt; &gt;&gt; Pasting does the job, however, it also overwrites the black background <BR>&gt; &gt;&gt; of<BR>&gt; &gt;&gt; each square-shaped particle-image (notice the square edges in the<BR>&gt; &gt;&gt; overlapping areas in the sample<BR>&gt; &gt;&gt; http://img81.imageshack.us/my.php?image=testyz7.png).<BR>&gt; &gt;<BR>&gt; &gt; In that case I dont know. Some guesses:<BR>&gt; &gt; *See if you can set the black border to a transparent color<BR>&gt; &gt; *Edit the pasting function to paste the pixels inside a cirle, leaving <BR>&gt; &gt; out<BR>&gt; &gt; the black corners/borders of the little images<BR>&gt; &gt; *As you are outputing PNG-files, can you create an int[][] and save<BR>&gt; &gt; this to a PNG-file in software outside ITK? There must be libraries for<BR>&gt; &gt; this. In this case you can have a function to return one of your little<BR>&gt; &gt; images/circles in a 10x10 matrix and specify which pixels should be <BR>&gt; &gt; copied<BR>&gt; &gt; to the array.<BR>&gt; &gt;<BR>&gt; &gt; Or you could wait until some of the nice people on this list with better<BR>&gt; &gt; programming skills than me answer your question :)<BR>&gt; &gt;<BR>&gt; &gt; chr.<BR>&gt; &gt;<BR>&gt; &gt;<BR>&gt; &gt;&gt; &gt; &gt; I am trying to simulate an image like this:&gt; &gt; &gt; &gt; <BR>&gt; &gt;&gt; http://ftp.sv.vt.edu/pub/projects97/pvlachos/pvlachos_project/images/piv.gif&gt; <BR>&gt; &gt;&gt; &gt; &gt; &gt; I started with creating small sized GaussianImageSource instances <BR>&gt; &gt;&gt; and pasting them at random positions on a background using <BR>&gt; &gt;&gt; PasteImageFilter. The problem is when two GaussianImageSource overlap <BR>&gt; &gt;&gt; as it can be seen in thios sample: <BR>&gt; &gt;&gt; http://img81.imageshack.us/my.php?image=testyz7.png&gt; &gt; &gt; &gt; (2) If not, <BR>&gt; &gt;&gt; how to get rid of the ovelaping problem?&gt; &gt; First thing that fell into <BR>&gt; &gt;&gt; my head:&gt; You could &gt; instantiate an int/bool array[][] img with your <BR>&gt; &gt;&gt; image size. Everytime you &gt; paste to some location (x,y) you set <BR>&gt; &gt;&gt; img[x][y] = 1/true. (also set all &gt; pixels covered by this image). Next <BR>&gt; &gt;&gt; time you want to paste to the image &gt; check the pixels you are going to <BR>&gt; &gt;&gt; paste into to se if there is an image &gt; there alredy. If there is, <BR>&gt; &gt;&gt; choose a new one.&gt; &gt; As the number of places a new image fits in the <BR>&gt; &gt;&gt; larger image the &gt; while(find_a_suitable_place) loop may take some <BR>&gt; &gt;&gt; time. I am sure you can &gt; come up with something clever to speed this <BR>&gt; &gt;&gt; up.&gt; &gt; Example: &gt; If your small images are 10x10 and you past to (0,0) <BR>&gt; &gt;&gt; you set &gt; img[0..10][0..10] = 1. &gt; If you try to paste the next small <BR>&gt; &gt;&gt; image to (2,2) (i guess you use a &gt; random-function for this) you check <BR>&gt; &gt;&gt; img[2..12][2..12]. Since these are not &gt; 0 you must search for a new <BR>&gt; &gt;&gt; location.&gt; &gt; Christian.&gt;<BR>&gt; &gt;&gt; _________________________________________________________________<BR>&gt; &gt;&gt; Be one of the first to try Windows Live Mail.<BR>&gt; &gt;&gt; http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; -- <BR>&gt; Gaëtan Lehmann<BR>&gt; Biologie du Développement et de la Reproduction<BR>&gt; INRA de Jouy-en-Josas (France)<BR>&gt; tel: +33 1 34 65 29 66 fax: 01 34 65 29 09<BR>&gt; http://voxel.jouy.inra.fr<BR><BR><br /><hr />Be one of the first to try  <a href='http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d' target='_new'>Windows Live Mail.</a></body>
</html>