Login  Register

Antwort: Re: automatic creation of a sphere embedded within a sphere?

Posted by Joachim Wesner on Feb 27, 2008; 5:27pm
URL: http://imagej.273.s1.nabble.com/automatic-creation-of-a-sphere-embedded-within-a-sphere-tp3697075p3697078.html

Hi there,

I was not the original poster of this problem, however  I thought along
those lines. Actually I even considered using makeoval and filling instead
of "solving"
the circle equation to generate the slices, but should work that way
too....

Joachim



                                                                           
             Justin McGrath                                                
             <[hidden email]                                            
             U>                                                         An
             Gesendet von:              [hidden email]                
             ImageJ Interest                                         Kopie
             Group                                                        
             <[hidden email].                                       Thema
             GOV>                       Re: automatic creation of a sphere
                                        embedded within a sphere?          
                                                                           
             26.02.2008 16:38                                              
                                                                           
                                                                           
              Bitte antworten                                              
                    an                                                    
              ImageJ Interest                                              
                   Group                                                  
             <[hidden email].                                            
                   GOV>                                                    
                                                                           
                                                                           




Joachim, how would you calculate the radius of the circle in each slice?

Would this work?

Use (x-x0)^2 + (y-y0)^2 + (z-z0)^2 = r^2.  r is whatever radius you want
and
x0,y0,z0 is the center of the sphere.  Then cycle through z (the stacks)
and
x in two for loops solving for y (two solutions).  Since y won't be an
integer, you could round to the nearest integer and scale the brightness
based on how close an integer it is (and you could calculate the brightness
for the neighboring pixels if you wanted).  Then use

setSlice(z);
setPixel(x, y_interger1, brightness*y1_scale);
setPixel(x, y_interger2, brightness*y2_scale);
//Maybe setPixel for neighbors as well.

You only need to cycle through x values between +(x0+r) and -(x0+r).

Justin

On Tue, Feb 26, 2008 at 8:50 AM, Joachim Wesner <
[hidden email]> wrote:

> HI Wes,
>
> this should be pretty easy with a macro and an image stack.
> You can draw a circle in a circle combined with fill as you already did
> and
> use the macro recorder to see what the corresponding code looks like
> (pretty simple),
>
> Then put this code in a loop that counts through all slices, adjusting
the

> radii (now variables) as necessary
>
> Joachim
> ____________________________________________
>
> Leica Microsystems CMS GmbH | GmbH mit Sitz in Wetzlar | Amtsgericht
> Wetzlar  HRB 2432
> Geschäftsführer:  Dr. Stefan Traeger | Dr. Wolf-Otto Reuter | Dr. David
> Roy
> Martyr | Colin Davis
>
>
>
>             Wes Armour
>             <wes.armour@DIAMO
>             ND.AC.UK>                                                  An
>             Gesendet von:              [hidden email]
>             ImageJ Interest                                         Kopie
>             Group
>             <[hidden email].                                       Thema
>             GOV>                       automatic creation of a sphere
>                                        embedded within a sphere?
>
>             26.02.2008 15:40
>
>
>              Bitte antworten
>                    an
>             wes.armour@diamon
>                  d.ac.uk
>
>
>
>
>
>
> Hi All,
>
> I'd like to create a text image that contains a black sphere within a
> grey sphere.
>
> I can do this easily for a 2d image of two circle, one embedded in the
> other. I could then create images of increasing and then decreasing
> radius. Using theses varying images I could get my sphere.
>
> This would be a lot of hard work, so I was wondering if there was a way
> to automate the creation of these 2d images???
>
> Thanks,
>
> Wes.
>
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>



______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________