c++ - How to use region-growing algorithms to define a region of interest? -
i working on dicom images (ct scans) & isolate structures of interest in picture such human organs (like aorta, cf image enclosed). coding in c++ of itk & vtk.
let's assume these organs have particular brightness intensity, therefore can automatically identify them using region-growing algorithm (code below). in order so, computed threshold values based on mean & standard deviation values of voxels belonging organ.
how can keep aorta in image of itk/vtk features? guess i'm looking filter exact opposite of itk mask image filter.
please find (pseudo) code corresponding organ isolation below. computed 5 voxels dilation on result of region-growing sure include voxels of organ , have sufficient margin around organ after cropping.
typedef short inputpixeltype; typedef unsigned char outputpixeltype; const int dimension = 3; typedef itk::image< inputpixeltype, dimension > inputimagetype; typedef itk::image< outputpixeltype, dimension > outputimagetype; // region growing typedef itk::connectedthresholdimagefilter< inputimagetype, outputimagetype > connectedfiltertype; connectedfiltertype::pointer connectedthreshold = connectedfiltertype::new(); connectedthreshold->setinput(input); connectedthreshold->setupper(upperthreshold); connectedthreshold->setlower(lowerthreshold); //initializing seed internalimagetype::indextype index; index[0] = seed_x; index[1] = seed_y; connectedthreshold->setseed(index); // dilate resulting region-growing of 5 voxels safety typedef itk::binaryballstructuringelement< outputimagetype, dimension > structuringelementtype; typedef itk::binarydilateimagefilter< outputimagetype, outputimagetype, struturingelementtype > dilatefiltertype; structuringelementtype structuringelement; structuringelement.setradius(5); structuringelement.createstructuringelement(); dilatefiltertype::pointer dilatefilter = dilatefiltertype::new(); dilatefilter->setinput(connectedthreshold->getoutput()); dilatefilter->setkernel(structuringelement); // saving results of rg+dilation typedef itk::imagefilewriter< outputimagetype > writertype; writertype::pointer writer = writertype::new(); writer->setinput(dilatefilter->getoutput()); writer->setfilename("organ-segmented-with-dilation.mhd"); try { writer->update(); } catch(itk::exceptionobject& err) { std::cerr << "exception caught! " << err.what() << std::endl; return exit_failure; } // next crop input image region-growing?
any or remark welcomed.
mask filter can opposite of does. default, masking value 0, , outside value. means parts of image correspond non-zero part of mask kept, , rest zeroed out. if not want, can invert logic setting different masking , outside values.
Comments
Post a Comment