[vtkusers] How to make CMakeLists.txt

Jérôme jerome.velut at gmail.com
Fri May 20 04:39:35 EDT 2011


Hi,
I think that the spaces inside your include directive are guilty.

HTH
Jerome

2011/5/20 sudhanshu gupta <sudhanshugupta2511 at gmail.com>

> HI
>
>
> CMakeLists.txt:
>
>
> cmake_minimum_required(VERSION 2.6)
>
> PROJECT(pipeline)
>
> FIND_PACKAGE(VTK REQUIRED)
> INCLUDE(${VTK_USE_FILE})
>
> ADD_EXECUTABLE(pipeline pipeline.cxx)
> TARGET_LINK_LIBRARIES(pipeline vtkIO)
>
>
>
>
> Code:
>
>
>
> #include< vtkImageReader.h >
> #include< vtkJPEGReader.h >
> #include< vtkImageDataGeometryFilter.h >
> #include< vtkWarpScalar.h >
> #include< vtkInteractorStyleTrackballCamera.h >
> #include< vtkRenderWindowInteractor.h >
> #include< vtkRenderWindow.h >
> #include< vtkRenderer.h >
> #include< vtkLODActor.h >
> #include< vtkPolyDataMapper.h >
> #include< vtkDataSetMapper.h >
> #include< vtkGeometryFilter.h >
> #include< vtkMergeFilter.h >
> #include< vtkTexture.h >
>
>     vtkImageReader *elevReader = vtkImageReader::New();
>     elevReader->SetFileName( "canyon_elev.raw" );
>     elevReader->SetDataExtent( 0, 1023, 0, 511, 0, 0 );
>     elevReader->SetDataScalarTypeToUnsignedChar( );
>     elevReader->Update( ); // Needed to generate contour scale !
>
>     vtkJPEGReader *textureReader = vtkJPEGReader::New( );
>     textureReader->SetFileName( "canyon_rgb.jpg" );
>
>
>     vtkImageDataGeometryFilter *geometry = vtkImageDataGeometryFilter::New(
> );
>     geometry->SetInput( elevReader->GetOutput( ) );
>
>     vtkWarpScalar *warper = vtkWarpScalar::New( );
>     warper->SetInput( ( vtkPointSet * ) ( geometry->GetOutput( ) ) );
>     warper->SetScaleFactor( scalingFactor );
>
>     vtkGeometryFilter *geomFilter = vtkGeometryFilter::New( );
>     geomFilter->SetInput( ( vtkDataSet * ) ( warper->GetOutput( ) ) );
>
>     vtkTexture *texture = vtkTexture::New( );
>     texture->SetInput( textureReader->GetOutput( ) );
>     texture->RepeatOff( );
>
>     vtkMergeFilter *merger = vtkMergeFilter::New( );
>     merger->SetGeometry( ( vtkDataSet * ) ( geomFilter->GetOutput( ) ) );
>     merger->SetScalars( ( vtkDataSet * ) ( textureReader->GetOutput( ) ) );
>
>     vtkGeometryFilter *geomFilter2 = vtkGeometryFilter::New( );
>     geomFilter2->SetInput( merger->GetOutput( ) );
>     float data[ 2 ], delta8;
>     elevReader->GetOutput( )->GetScalarRange( data );
>     dataMin = data[ 0 ];
>     dataMax = data[ 1 ];
>     delta8 = ( data[ 1 ] - data[ 0 ] ) / 8;
>     cout << "Data Min, Max, delta8 = " << dataMin << ", " << dataMax << ",
> "
>         << delta8 << endl;
>     for( i = 0; i < 4; i++ ) {
>         contours[ i ] = vtkContourFilter::New( );
>         contours[ i ]->SetInput( ( vtkDataSet * ) ( elevReader->GetOutput(
> ) ) );
>         contourHeights[ i ] = data[ 0 ] + delta8 * ( 2 * i + 1 );
>         contours[ i ]->SetValue( 0, contourHeights[ i ] );
>     }
>     vtkDataSetMapper *surfaceMapper = vtkDataSetMapper::New();
>     surfaceMapper->SetInput( ( vtkDataSet * ) ( geomFilter2->GetOutput()
> ));
>     surfaceMapper->SetScalarRange( 0, 255 );
>
>     vtkPolyDataMapper *contourMappers[ 4 ];
>     for( i = 0; i < 4; i++ ) {
>         contourMappers[ i ] = vtkPolyDataMapper::New();
>         contourMappers[ i ]->SetInput( contours[ i ]->GetOutput() );
>         contourMappers[ i ]->SetScalarModeToUsePointFieldData( );
>     }
>
>     vtkLODActor *surfaceActor = vtkLODActor::New();
>     surfaceActor->SetMapper( surfaceMapper );
>     surfaceActor->SetTexture( texture );
>     float colors[ 4 ] [ 3 ] = { { 1.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 },
>         { 0.0, 0.0, 1.0 }, { 1.0, 1.0, 0.0 } };
>     for( i = 0; i < 4; i++ ) {
>         contourActors[ i ] = vtkActor::New( );
>         contourActors[ i ]->SetMapper( contourMappers[ i ] );
>         contourActors[ i ]->GetProperty( )->SetColor( colors[ i ] );
>     }
>
>
>     vtkRenderer *ren1= vtkRenderer::New();
>     ren1->AddActor( surfaceActor );
>     ren1->SetBackground( 0.1, 0.2, 0.4 );
>     ren1->SetViewport(0.0, 0.0, 1.0, 1.0);
>     for( i = 0; i < 4; i++ ) {
>         ren1->AddActor( contourActors[ i ] );
>         contourActors[ i ]->AddPosition( 0.0, 0.0, 2.0 - contourHeights[ i
> ] );
>     }
>
>
>     vtkRenderWindow *renWin = vtkRenderWindow::New();
>     renWin->AddRenderer( ren1 );
>     renWin->SetSize( 600, 600 );
>
>     vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
>     iren->SetRenderWindow(renWin);
>
>     vtkInteractorStyleTrackballCamera *style =
> vtkInteractorStyleTrackballCamera::New();
>     iren->SetInteractorStyle(style);
>
>     iren->Initialize();
>     iren->Start();
>
>     elevReader->Delete();
>     ren1->Delete();
>     renWin->Delete();
>     iren->Delete();
>     style->Delete();
>
>     return 0;
> }
>
>
>
> Error:
>
> Scanning dependencies of target pipeline
>
> [100%] Building CXX object CMakeFiles/pipeline.dir/pipeline.cxx.o
> /home/sudhanshu/pipeline/pipeline.cxx:1: fatal error:  vtkImageReader.h :
> No such file or directory
> compilation terminated.
> make[2]: *** [CMakeFiles/pipeline.dir/pipeline.cxx.o] Error 1
> make[1]: *** [CMakeFiles/pipeline.dir/all] Error 2
> make: *** [all] Error 2
>
>
> Please see whats the problem I am not able to configure it.
> Thank you..
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110520/5c4c4f20/attachment.htm>


More information about the vtkusers mailing list