[vtkusers] Read Rectilineargrid File::Only the grid is visible

Winfried Bilgic 4Winne at web.de
Thu Sep 22 04:08:14 EDT 2005



Hello Again, 

i tried this, but i got a white surface and i used the vtkDataSetMapper with the same result. I modified my SourceCode to navigate directly to the vector dataset (clReader->SetVectorsName(const char*)) and update the reader (clReader->Update();), with the result that i see with clGrid->Print(cout), that there is a grid and PointData available... i think i need an extra Mapper.

What you think ? Winne


My SourceCode looks now like:
int main()
{
	char *cVTKFile = NULL;
	// cVTKFile = "./files/dump-1.80000e+003.asc.vtk";
	// cVTKFile = "./files/mslfilter.vtk";
	cVTKFile = "./files/Original.vtk";

	unsigned int i=0;
	unsigned int uiQtyOfVectorSets = 0;
	char **cDataNames = NULL;
	vtkDataSetReader *clReader = vtkDataSetReader::New();
	clReader->SetFileName(cVTKFile);
	uiQtyOfVectorSets=clReader->GetNumberOfVectorsInFile();
	if (uiQtyOfVectorSets==0) { fprintf(stderr,"No Vectorset inside... exiting !\n"); clReader->Delete(); return 0; }
	
	cDataNames = new char*[uiQtyOfVectorSets];
	for(i=0;i<uiQtyOfVectorSets;i++)
	{
		cDataNames[i] = new char[strlen(clReader->GetVectorsNameInFile(i))+1];
		strcpy(cDataNames[i],clReader->GetVectorsNameInFile(i));
		//fprintf(stderr,"VectorSet (%u):: %s\n",i,cDataNames[i]);
	}
	clReader->SetVectorsName(cDataNames[10]);
	clReader->Update();
	//clReader->Print(cout);
		
	vtkRectilinearGrid *clGrid = NULL;
	clGrid = clReader->GetRectilinearGridOutput();
	unsigned int uiXCells = clGrid->GetDimensions()[0];
	unsigned int uiYCells = clGrid->GetDimensions()[1];
	unsigned int uiZCells = clGrid->GetDimensions()[2];
	fprintf(stderr,"Dimension:: %u x %u x %u\n",uiXCells,uiYCells,uiZCells);
	
	vtkPointData *clPointData = NULL;
	clPointData = clGrid->GetPointData();
	// Irgandwas muss hier noch kommen ?
		
	vtkRectilinearGridGeometryFilter *clFilter = vtkRectilinearGridGeometryFilter::New();
	clFilter->SetInput(clGrid);
	clFilter->SetExtent(0,uiXCells-1,0,uiYCells-1,0,0);
	
	vtkPolyDataMapper *clMapper = vtkPolyDataMapper::New();
	clMapper->SetInput(clFilter->GetOutput());
	clMapper->SetColorModeToMapScalars();
...


Burlen <burlen at apollo.sr.unh.edu> schrieb am 22.09.05 02:29:04:

Hi, I think you might try to change

clActor->GetProperty()->SetRepresentationToWireframe();

to

clActor->GetProperty()->SetRepresentationToSurface();
.
try that

On Wednesday 21 September 2005 02:15 pm, Winfried Bilgic wrote:
> Hello Folks,
>
> i tried many things but i was still unable to read an vector dataset from
> an rectilinear gridfile. What i get from the file is the visualization of
> the grid, but no surface. I bet the solution is easy, but with 11 hours
> working in my neck i need your helpful assistence.
>
> Thanks in advance and kind regards Winne
>
> SourceCode::
> #include "vtkDataReader.h"
> #include "vtkDataSet.h"
> #include "vtkRectilinearGridReader.h"
> #include "vtkRectilinearGrid.h"
> #include "vtkRectilinearGridGeometryFilter.h"
> #include "vtkRenderer.h"
> #include "vtkRenderWindow.h"
> #include "vtkRenderWindowInteractor.h"
> #include "vtkActor.h"
> #include "vtkProperty.h"
> #include "vtkPolyDataMapper.h"
>
> int main()
> {
> 	char *cVTKFile = NULL;
> 	// cVTKFile = "./files/dump-1.80000e+003.asc.vtk";
> 	cVTKFile = "./files/mslfilter.vtk";
> 	// cVTKFile = "./files/Original.vtk";
>
> 	vtkRectilinearGridReader *clReader = vtkRectilinearGridReader::New();
> 	clReader->SetFileName(cVTKFile);
>
> 	vtkRectilinearGrid *clGrid = NULL;
> 	vtkPointData *clPointData = NULL;
> 	clGrid=clReader->GetOutput(0);
>
> 	vtkRectilinearGridGeometryFilter *clGeoGrid =
> vtkRectilinearGridGeometryFilter::New(); clGeoGrid->SetInput(clGrid);
>
> 	vtkPolyDataMapper *clMapper = vtkPolyDataMapper::New();
> 	clMapper->SetInput(clGeoGrid->GetOutput());
>
> 	vtkActor *clActor = vtkActor::New();
> 	clActor->SetMapper(clMapper);
> 	clActor->GetProperty()->SetRepresentationToWireframe();
>
> 	vtkRenderer *clRen= vtkRenderer::New();
> 	clRen->AddActor(clActor);
>
> 	vtkRenderWindow *clRenWin = vtkRenderWindow::New();
> 	clRenWin->AddRenderer(clRen);
> 	clRenWin->SetSize(800,800);
>
> 	vtkRenderWindowInteractor *clIren = vtkRenderWindowInteractor::New();
> 	clIren->SetRenderWindow(clRenWin);
>
> 	clRenWin->Render();
> 	clIren->Start();
> 	clIren->Delete();
> 	clRenWin->Delete();
> 	clRen->Delete();
> 	clActor->Delete();
> 	clMapper->Delete();
> 	clGeoGrid->Delete();
> 	clReader->Delete();
>
> 	return 0;
> }
>
> _______________________________________________
> 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
_______________________________________________
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