<html><BR><BR><BR>
<DIV>
<P> </P></DIV></html>
I have a volume in a file of 8 bits,I assign it to a structure points which you have the dimensions 255*255*64 assign an adjustment to him of you will climb whole, like the dimensions, the space and the origin to my structure points with the estrutura I want to make a isosuperficie, but it marks an error violation of segment in the Render.
The error this in render and not by that since I want to do is apply Isosuperfice to a structured point.
int main(int argc,char *argv[])
{
vtkStructuredPoints *Estru= vtkStructuredPoints::New();
unsigned short Dat[256*256*64];
FILE *arch01;
char cad[10];
short int num;
if(((arch01=fopen(archivo,"rb"))!=NULL))
{
contador=0;
while (!feof(arch01))
{
fread(&num,sizeof(char),1,arch01);
Dat[contador]=num;
contador++;
}
fclose(arch01);
}
vtkUnsignedShortArrays Datos=vtkUnsignedShortArray::New();
int conta;
Datos->Allocate(Dimensiones[0]*Dimensiones[1]*Dimensiones[2]);
Datos->SetNumberOfComponents(Dimensiones[0]*Dimensiones[1]*Dimensiones[2]);
for (conta=0;conta<(Dimensiones[0]*Dimensiones[1]*Dimensiones[2]);conta++)
{
Datos->InsertValue(conta,Dat[conta]);
}
Estru->SetScalarType(VTK_UNSIGNED_SHORT);
Estru->SetDimensions(256,256,64);
Estru->SetNumberOfScalarComponents(1);
Estru->SetSpacing(1.5,1.5,1.5);
Estru->SetOrigin(0,0,0);
Estru->GetPointData()->SetScalars(Datos);
vtkRenderWindow *renWin = vtkRenderWindow::New();
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
vtkRenderer *ren = vtkRenderer::New();
renWin->AddRenderer(ren);
renWin->SetSize(400,350);
vtkContourFilter *skinExtractor = vtkContourFilter::New();
skinExtractor->SetInput((vtkDataSet *) Estru);
skinExtractor->SetValue(0, 500);
vtkPolyDataNormals *skinNormals = vtkPolyDataNormals::New();
skinNormals->SetInput(skinExtractor->GetOutput());
skinNormals->SetFeatureAngle(60.0);
vtkPolyDataMapper *skinMapper = vtkPolyDataMapper::New();
skinMapper->SetInput(skinNormals->GetOutput());
skinMapper->ScalarVisibilityOff();apply ray casting to a structured point
vtkActor *skin = vtkActor::New();
skin->SetMapper(skinMapper);
vtkCamera *aCamera = vtkCamera::New();
aCamera->SetViewUp (0, 0, -1);
aCamera->SetPosition (0, 1, 0);
aCamera->SetFocalPoint (0, 0, 0);
aCamera->ComputeViewPlaneNormal();
ren->AddActor(skin);
ren->SetActiveCamera(aCamera);
ren->ResetCamera ();
aCamera->Dolly(1.5);
ren->SetBackground(1,1,1);
renWin->SetSize(640, 480);
ren->GetActiveCamera()->Zoom(2.0);
renWin->Render();
iren->Start();
ren->Delete();
iren->Delete();
renWin->Delete();
skinExtractor->Delete();
skinNormals->Delete();
skinMapper->Delete();
skin->Delete();
return 0;
}
_________________________________________________________________
T1msn Fotos: Todo lo que quieres saber sobre fotografía digital http://search.t1msn.com.mx/