[vtkusers] Re: Generating 3D Objects from an unsigned short Array
Goodwin Lawlor
goodwin.lawlor at ucd.ie
Fri Nov 19 02:46:33 EST 2004
Hi Markus,
You could use:
- vtkImageGaussianSmooth filter before vtkContourFilter
- vtkWindowedSincPolyDataFilter or vtkSmoothPolyDataFilter before
vtkPolyDataNormals
hth
Goodwin
"Markus Fawer" <markusfawer at swissonline.ch> wrote in message
news:200411182122.iAILMC7g020502 at smtp.hispeed.ch...
Hi all,
I have currently two main problems with vtk:
1) I have some segmented OCT pictures (slices) which I should use, to
create a 3-dimensional object of the different values in those pictures.
I tried to use the vtkContourFilter, but this returns an ugly kind of
surface, and not a real 3-dimensional object. I should also have a smoother
representation of the segments. The volume should contain interpolated
values between the slices. I know that Interpolation is possible, when using
widgets, but I couldn't find a method or class to interpolate values
creating 3 dimensional objects. Can anybody help me to find a solution to
solve this problem
(Pipeline), or maybe tell me the best parameters to get a smooth surface
using the code shown below?
2) The second OCT pictures I have are from a different kind of scans.
These scans are made from one starting point (for all pictures) in different
directions. (e.g every 30 degrees). Is there a possibility to construct the
3-dimensional volume of these pictures? Again the representation of the
objects should be smoothed.
The data of the pictures is, as in Problem 1), delivered in an unsigned
short Array, containing all the images.
Thanks
Markus
Code to Problem 1:
vtkUnsignedShortArray *pScalars = vtkUnsignedShortArray::New();
pScalars->SetNumberOfComponents(1);
pScalars->SetArray((unsigned short*)
m_pDataIn->pImageData->pArrImageData[0], nSize, 1);
vtkData* m_pImageData = vtkData::New();
m_pImageData->SetDimensions(..);
m_pImageData->SetScalarTypeToUnsignedShort();
m_pImageData->SetSpacing(.);
m_pImageData->GetPointData()->SetScalars(pScalars);
m_pImageData->Update();
vtkContourFilter* pContourFilter = vtkContourFilter::New();
pContourFilter->SetInput(m_pImageData);
pContourFilter->SetNumberOfContours(0);
pContourFilter->SetValue(0, m_nKontur1); // 800 <
m_nKontur < 2600
vtkDecimatePro* pDecimatePro = vtkDecimatePro::New();
pDecimatePro->SetInput(pContourFilter->GetOutput());
pDecimatePro->PreserveTopologyOn();
pDecimatePro->BoundaryVertexDeletionOn();
pDecimatePro->SetDegree(90);
vtkPolyDataNormals* m_pPolyDataNormals = vtkPolyDataNormals::New();
m_pPolyDataNormals->SetInput(pDecimatePro->GetOutput());
m_pPolyDataNormals->SetFeatureAngle(90);
m_pPolyDataNormals->Update();
vtkPolyDataMapper* pPolyDataMapper = vtkPolyDataMapper::New();
pPolyDataMapper->SetInput(m_pPolyDataNormals->GetOutput());
pPolyDataMapper->ScalarVisibilityOff();
vtkActor* m_pActorVolume = vtkActor::New();
m_pActorVolume->SetMapper(pPolyDataMapper);
m_pActorVolume->GetProperty->SetColor(..);
m_pActorVolume->GetProperty->SetOpacity(..);
m_pRenderer->SetActor(m_pActorVolume);
:
:
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at:
<http://www.vtk.org/Wiki/VTK_FAQ>
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list