-
Notifications
You must be signed in to change notification settings - Fork 103
Example: Seeded region growing
Erik Smistad edited this page Jun 11, 2018
·
4 revisions
#include "FAST/Algorithms/SeededRegionGrowing/SeededRegionGrowing.hpp"
#include "FAST/Algorithms/SurfaceExtraction/SurfaceExtraction.hpp"
#include "FAST/Visualization/TriangleRenderer/TriangleRenderer.hpp"
#include "FAST/Visualization/SimpleWindow.hpp"
using namespace fast;
int main() {
// Import CT image
ImageFileImporter::pointer importer = ImageFileImporter::New();
importer->setFilename(Config::getTestDataPath() + "CT/CT-Abdomen.mhd");
// Perform region growing segmentation
SeededRegionGrowing::pointer segmentation = SeededRegionGrowing::New();
segmentation->setInputConnection(importer->getOutputPort());
segmentation->addSeedPoint(223,282,387);
segmentation->addSeedPoint(251,314,148);
segmentation->setIntensityRange(150, 5000);
// Extraction surface mesh from segmentation
SurfaceExtraction::pointer extraction = SurfaceExtraction::New();
extraction->setInputConnection(segmentation->getOutputPort());
// Render and visualize the mesh
TriangleRenderer::pointer surfaceRenderer = TriangleRenderer::New();
surfaceRenderer->setInputConnection(extraction->getOutputPort());
surfaceRenderer->enableRuntimeMeasurements();
SimpleWindow::pointer window = SimpleWindow::New();
window->addRenderer(surfaceRenderer);
#ifdef FAST_CONTINUOUS_INTEGRATION
// This will automatically close the window after 5 seconds, used for CI testing
window->setTimeout(5*1000);
#endif
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