-
Notifications
You must be signed in to change notification settings - Fork 103
Example: Surface extraction
Erik Smistad edited this page Jun 17, 2015
·
3 revisions
/**
* Examples/Visualization/extractSurfaceAndRender.cpp
*
* If you edit this example, please also update the wiki and source code file in the repository.
*/
#include "FAST/Importers/ImageFileImporter.hpp"
#include "FAST/Algorithms/SurfaceExtraction/SurfaceExtraction.hpp"
#include "FAST/Visualization/MeshRenderer/MeshRenderer.hpp"
#include "FAST/Visualization/SimpleWindow.hpp"
using namespace fast;
int main() {
// Import CT image
ImageFileImporter::pointer importer = ImageFileImporter::New();
importer->setFilename(std::string(FAST_TEST_DATA_DIR) + "CT-Abdomen.mhd");
// Extract surface mesh using a threshold value
SurfaceExtraction::pointer extraction = SurfaceExtraction::New();
extraction->setInputConnection(importer->getOutputPort());
extraction->setThreshold(300);
// Render and visualize the mesh
MeshRenderer::pointer surfaceRenderer = MeshRenderer::New();
surfaceRenderer->setInputConnection(extraction->getOutputPort());
SimpleWindow::pointer window = SimpleWindow::New();
window->addRenderer(surfaceRenderer);
window->setTimeout(5*1000); // automatically close window after 5 seconds
window->start();
}
If this wiki page lacks some information or is incorrect please let us know! You can edit this wiki page yourself, send an email to ersmistad@gmail.com or