Wednesday, September 13, 2006

Creating An Ellipse

To create a set of points to represent an ellipse, I first used the equation (x2/792) + (y2/952) = 1, solving for y and inserting x-values from -79 to 79, with increments of 0.5. This created around 600 points. The problem was that the sides of the ellipse contained very few points, due to the relatively high changes in the y-direction along the left and right sides of the ellipse. Using the equation in polar coordinates resolved that problem. This was accomplished by incrementing from zero to 2π and plugging that into r2 = (792952) / (792sin2(Θ) + 952cos2(Θ)) as the angle. After converting the resulting polar coordinates into rectangular ones, I was able to create an ellipse that had a uniform spread of points along the border. The following is an image of the ellipse using the rectangular coordinate representation of the equation on the left, and the one using the polar coordinate representation on the right:

Once I had all the points stored into an itkPointSet, I tried to incorporate that into the registration process, but ended up with a segmentation fault error. Taking the itkPointSet that was the output from the spatial object filter on the old ellipse, and replacing its point data with my newly created points fixed the problem. There is some parameter on the itkPointSet that I need to set to get it to work properly. I used the function "Print( std::cout )", that is a part of each itkPointSet, to print out and compare the details of the two itkPointSet objects. The only differences were in the fields "Requested Number Of Regions" with the old point set having its value as two, and mine have a value of zero, and in the field "Reference Count" with a two for the old point set and one for mine.

0 Comments:

Post a Comment

<< Home