[ITK-users] Creating 3D dome using ITK
sidharta
sidharta.gupta93 at gmail.com
Wed May 10 06:19:37 EDT 2017
Dear all,
I am trying to make a 3D dome (ie; Half Sphere) and then generating a binary
image out of it. The aim is to use this binary image as a mask in
maskFilter. I was able to generate a 2D circular mask, which was straight
forward. I used this in a maskFilter and masked the 3D image using
slicebysliceFilter.
I can think of two ways to do it:
1. Make several masks of decreasing circle radius which ultimately would
represent a dome.
2. Make a mask image and assign the values at indices accordingly to get a
dome mask.
The first step seems doable but to my understanding would be an overkill.
I am not able to do the second step. Following is the code I tried:
float MY_RADIUS = maskRegion.GetSize()[0];
MaskIteratorType iterator(maskImage, maskImage->GetLargestPossibleRegion());
while (!iterator.IsAtEnd())
{
const InputImageType::IndexType & index = iterator.GetIndex();
std::cout << "Index is " << index;
float value = (index[0] - centerPoint[0]) * (index[0] - centerPoint[0])
+ (index[1] - centerPoint[1]) * (index[1] - centerPoint[1]);
std::cout << "Compare - LHS = " << value << " RHS = " << MY_RADIUS *
MY_RADIUS << std::endl;
if ((index[0] - centerPoint[0]) * (index[0] - centerPoint[0])
+ (index[1] - centerPoint[1]) * (index[1] - centerPoint[1])
<= MY_RADIUS * MY_RADIUS)
{
iterator.Set(1);
}
--MY_RADIUS;
++iterator;
}
After adding the cout commands I saw that --MY_RADIUS is incorrect. I
generated the required sphere using matlab, just to get the values I should
assign to the pixels.
Additionally, I noticed there is a need for anti-aliasing to the mask.
Kindly let me know how this can be done iteratively.
Thank you!
--
View this message in context: http://itk-users.7.n7.nabble.com/Creating-3D-dome-using-ITK-tp38201.html
Sent from the ITK - Users mailing list archive at Nabble.com.
More information about the Insight-users
mailing list