[vtkusers] vtkPolyDataToImageStencil

Nil Goyette nil.goyette at imeka.ca
Thu Apr 30 10:54:41 EDT 2015


Hi all,

I'm  using vtkPolyDataToImageStencil to get all voxels index inside of a 
surface. If I understand correctly, I have only two choices here:
- vtkImageStencil to create a new image
- vtkImageStencilIterator to iterate on the values (of another image)
The problem is, I have a different goal in mind. I need the index of all 
voxels inside a surface.

I read the vtkPolyDataToImageStencil code and tried to create my own 
"iterator" but there's probably something I don't understand; 
GetNextExtent always return 0.
bool GetNext(int& x1, int& x2, int& y, int& z)
{
   // m_Y, m_Z and m_Iter == 0
   int maxX, maxY, maxZ, dump;
   m_ImageStencilData->GetExtent(dump, maxX, dump, maxY, dump, maxZ);
   maxX *= 2; maxY *= 2; maxZ *= 2;

   for ( ; m_Z <= maxZ; ++m_Z)
   {
     for ( ; m_Y <= maxY; ++m_Y)
     {
       if (m_ImageStencilData->GetNextExtent(x1, x2, 0, maxX, m_Y, m_Z, 
m_Iter))
       {
         y = m_Y; z = m_Z;
         return true;
       }
     }
   }
   return false;
}

Is there a way to access all inside-voxels hidden in the 
vtkPolyDataToImageStencil? By index or by index range, it's not 
important. I just want to know to access them without useless work (like 
creating an image) because it's gonna be called often; it needs to be 
fast. Thank you for your time.

Nil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150430/2db2481f/attachment.html>


More information about the vtkusers mailing list