// IdentifyMeshPoints.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; // Set VTK data root here.. #define VTK_DATA_ROOT "Y:\\Maura\\Full_Skulls\\Point-Digitization\\f1\\" int main(int argc, char** argv) { // This example demonstrates the use of vtkSTLReader to load data into VTK from // a file. This example also uses vtkLODActor which changes its graphical // representation of the data to maintain interactive performance. // // First we include the VTK Tcl packages which will make available // all of the vtk commands to Tcl // // Create the reader and read a data file. Connect the mapper and actor. //string directory_path = "Y:\\Maura\\Full_Skulls\\Point-Digitization\\"; // Contains digitized points for each skull //std::cout << "Have " << argc << " arguments:" << std::endl; //for (int i = 0; i < argc; ++i) //{ // std::cout << argv[i] << std::endl; //} //// Check an STL file name has been provided // switch (argc) // { // case 0: // cout << "\n Main error. Exit Program \n" << endl; // return(9); // break; // case 1: // cout << "\n Too few input arguments. Exit Program \n" << endl; // return(8); // break; // case 2: // break; // default: // cout << "\n Too many input arguments. Exit Program \n" << endl; // return(7); // } // // DIR* dir = opendir(directory_path.c_str()); // if (!dir) // { // cerr << "\n Cannot open directory " << directory_path << endl; // cerr.flush(); // return 1; // } // cout << "\n directory_path: " << directory_path << endl; vtkSTLReader* sr = vtkSTLReader::New(); sr->SetFileName(VTK_DATA_ROOT "f1.stl"); vtkPolyDataMapper* stlMapper = vtkPolyDataMapper::New(); stlMapper->SetInputConnection(sr->GetOutputPort()); vtkLODActor* stlActor = vtkLODActor::New(); stlActor->SetMapper(stlMapper); // Create the Renderer, RenderWindow, and RenderWindowInteractor // vtkRenderer* ren1 = vtkRenderer::New(); vtkRenderWindow* renWin = vtkRenderWindow::New(); renWin->AddRenderer(ren1); vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New(); iren->SetRenderWindow(renWin); // Add the actors to the render; set the background and size // ren1->AddActor(stlActor); ren1->SetBackground(0.1, 0.2, 0.4); renWin->SetSize(500, 500); // Zoom in closer ren1->ResetCamera(); vtkCamera* cam1 = (ren1->GetActiveCamera()); cam1->Zoom(1.4); iren->Initialize(); iren->Start(); return 0; } // Run program: Ctrl + F5 or Debug > Start Without Debugging menu // Debug program: F5 or Debug > Start Debugging menu // Tips for Getting Started: // 1. Use the Solution Explorer window to add/manage files // 2. Use the Team Explorer window to connect to source control // 3. Use the Output window to see build output and other messages // 4. Use the Error List window to view errors // 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project // 6. In the future, to open this project again, go to File > Open > Project and select the .sln file