[Insight-users] How to create a set of spatially distributed images

Christian Marshall Rieck rieck at stud.ntnu.no
Mon Jan 8 07:25:51 EST 2007


> Thanks for the reply, I am NOT avoiding the overlapping -- I just want 
>the particle-images to be overlapped naturally. That is, at each 
>overlapping region, the pixel values of one of the particle-images must  
>overwrite (NOT be added to) the pixel values of the other particle-image.  
>Pasting does the job, however, it also overwrites the black background of  
>each square-shaped particle-image (notice the square edges in the  
>overlapping areas in the sample  
>http://img81.imageshack.us/my.php?image=testyz7.png).

In that case I dont know. Some guesses:
*See if you can set the black border to a transparent color
*Edit the pasting function to paste the pixels inside a cirle, leaving out 
the black corners/borders of the little images
*As you are outputing PNG-files, can you create an int[][] and save 
this to a PNG-file in software outside ITK? There must be libraries for 
this. In this case you can have a function to return one of your little 
images/circles in a 10x10 matrix and specify which pixels should be copied 
to the array. 

Or you could wait until some of the nice people on this list with better 
programming skills than me answer your question :)

chr.


> > > I am trying to simulate an image like this:> > > > http://ftp.sv.vt.edu/pub/projects97/pvlachos/pvlachos_project/images/piv.gif> > > > I started with creating small sized GaussianImageSource instances and pasting them at random positions on a background using PasteImageFilter. The problem is when two GaussianImageSource overlap as it can be seen in thios sample: http://img81.imageshack.us/my.php?image=testyz7.png> > > > (2) If not, how to get rid of the ovelaping problem?> > First thing that fell into my head:> You could > instantiate an int/bool array[][] img with your image size. Everytime you > paste to some location (x,y) you set img[x][y] = 1/true. (also set all > pixels covered by this image). Next time you want to paste to the image > check the pixels you are going to paste into to se if there is an image > there alredy. If there is, choose a new one.> > As the number of places a new image fits in the larger image the > while(find_a_suitable_place) loop may take some time. I am sure you can > come up with something clever to speed this up.> > Example: > If your small images are 10x10 and you past to (0,0) you set > img[0..10][0..10] = 1. > If you try to paste the next small image to (2,2) (i guess you use a > random-function for this) you check img[2..12][2..12]. Since these are not > 0 you must search for a new location.> > Christian.> 
> _________________________________________________________________
> Be one of the first to try Windows Live Mail.
> http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d


More information about the Insight-users mailing list