[vtkusers] something about the HeadBone file.

#YAN RI AN# PS7278514B at ntu.edu.sg
Thu Aug 29 09:11:44 EDT 2002


Dear All:
I use the window NT based computer & VC6.0 compiler.
 I  meet the problem when I convert the headBone.tcl to Cxx file.
I add the file : vtkMarchingCubes.h, vtkMarchingCubes.cxx to the project.
When I bulid it. It give me a warning that vtkMarchingCubes.h something wrong.
Could anyone give me some suggest about it.

The source code below:
		#include "vtkLight.h"
		#include "vtkMergePoints.h"
		#include "vtkVolume16Reader.h"
		#include "vtkMarchingCubes.h"
		#include "vtkVectorNorm.h"
		#include "vtkDataSetMapper.h"
		#include "vtkOutlineFilter.h"
		#include "vtkActor.h"
		#include "vtkRenderer.h"
		#include "vtkRenderWindow.h"
		#include "vtkRenderWindowInteractor.h"

		int main(int argc, char *argv[])
		{
		  vtkRenderer *ren1 = vtkRenderer::New();
		//  ren1->AddActor(actor);
		//  ren1->SetBackground(0, 0, 1);
		// ren1->GetActiveCamera()->Zoom(1.5);

		  vtkRenderWindow *renWin = vtkRenderWindow::New();
		  renWin->AddRenderer(ren1);
		//  renWin->SetSize(500,500);


		  vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
		  iren->SetRenderWindow(renWin);	


		  vtkLight *lgt=vtkLight::New();


		  vtkMergePoints *locator=vtkMergePoints::New();
		  locator->SetDivisions(32,32,46);
		  locator->RetainCellListsOff();
		  locator->SetNumberOfPointsPerBucket(2);
		  locator->AutomaticOff();

		  vtkVolume16Reader *v16=vtkVolume16Reader::New();
		    v16->SetDataDimensions(64,64);
		    v16->GetOutput()->SetOrigin(0,0,0);
		    v16->SetDataByteOrderToLittleEndian();
		    v16->SetFilePrefix("c:/Vtkdata/Data/headsq/quarter");
		    v16->SetImageRange(1,93);
		    v16->SetDataSpacing(3.2,3.2,1.5);

			vtkMarchingCubes *iso=vtkMarchingCubes::New();
		    iso->SetInput(v16->GetOutput());
		    iso->SetValue(0,1150);
		    iso->ComputeGradientsOn();
		    iso->ComputeScalarsOff();
		    iso->SetLocator(locator);

			vtkVectorNorm *gradient=vtkVectorNorm::New();
			gradient->SetInput(iso->GetOutput());

		  vtkDataSetMapper *isoMapper=vtkDataSetMapper::New();
		    isoMapper->SetInput(gradient->GetOutput());
		    isoMapper->ScalarVisibilityOn();
		    isoMapper->SetScalarRange(0,1200);
		    isoMapper->ImmediateModeRenderingOn();

			vtkActor *isoActor=vtkActor::New();
		    isoActor->SetMapper(isoMapper);
			isoActor->GetProperty()->SetColor(0,0,1);

		//	set->isoProp(isoActor->GetProperty());
		//	eval->isoProp->SetColor(0,0,1);

			vtkOutlineFilter *outline=vtkOutlineFilter::New();
		    outline->SetInput(v16->GetOutput());
			vtkPolyDataMapper *outlineMapper=vtkPolyDataMapper::New();
		    outlineMapper->SetInput(outline->GetOutput());

			vtkActor *outlineActor=vtkActor::New();
		    outlineActor->SetMapper(outlineMapper);
			outlineActor->GetProperty()->SetColor(0,0,0);
		//	set->outlineProp(outlineActor->GetProperty());
		//	eval->outlineProp->SetColor(0,0,0);

		// Add the actors to the renderer, set the background and size

			ren1->AddActor(outlineActor);
			ren1->AddActor(isoActor);
			ren1->SetBackground(1,1,1);
			ren1->AddLight(lgt);
			renWin->SetSize(250,250);
			ren1->SetBackground(0.1,0.2,0.4);


		 //   lgt->SetPosition(cam1->GetPosition());
		//    lgt->SetFocalPoint(cam1->GetFocalPoint());

		//	ren1->ResetCameraClippingRange();

		  // This starts the event loop and as a side effect causes an initial render.
		  renWin->Render();
		  iren->Start();

		  ren1->Delete();
		  renWin->Delete();
		  iren->Delete();
		  return 0;
		}
		the Cmake list is:
		PROJECT (headBone)

		INCLUDE (${CMAKE_ROOT}/Modules/FindVTK.cmake)
		IF (USE_VTK_FILE)
		  INCLUDE(${USE_VTK_FILE})
		ENDIF (USE_VTK_FILE)

		LINK_LIBRARIES( 
		  vtkCommon
		  vtkFiltering
		  vtkGraphics
		  vtkHybrid
		  vtkImaging
		  vtkIO
		  vtkjpeg
		  vtkParallel
		  vtkPng
		  vtkRendering
		  vtkzlib
		)

		ADD_EXECUTABLE(headBone headBone.cxx)

		thanks very much.
		my e-mail address is :
		ps7278514b at ntu.edu.sg <mailto:ps7278514b at ntu.edu.sg>
*************************************** 
* Best Regards
* Yan Rian (Research Student) 
* Email : ps7278514b at ntu.edu.sg
* Lab : AMRC Research Centre 
* Nanyang Technological University 
* Singapore 
***************************************





More information about the vtkusers mailing list