[ITK Community] [Insight-users] Level Set Chan and Vese with 0 iterations
Inspiracionv
inspiracionv at gmail.com
Tue Feb 25 10:19:49 EST 2014
Hi all,
I was using a level set chan and vese and it worked well.
I started a new software where i need this and i use the same code but in
this case the level set don't do iterations.
Here is the code :
/ int rectX = centreX-150;
int rectY = centreY-150;
int width, height;
width = height = 300;
//Cut the image
ImageType::Pointer feature = MyITKFilter::crop(image,rectX,rectY,width,
height);
//Create FastMarching
ImageType::Pointer phi = MyITKFilter::phiCV(image,150,150,50);
typedef itk::ScalarChanAndVeseLevelSetFunctionData< ImageType,ImageType
> DataHelperType;
typedef itk::ConstrainedRegionBasedLevelSetFunctionSharedData<ImageType,
ImageType, DataHelperType > SharedDataHelperType;
typedef itk::ScalarChanAndVeseLevelSetFunction< ImageType, ImageType,
SharedDataHelperType > LevelSetFunctionType;
typedef itk::AtanRegularizedHeavisideStepFunction< PixelType,PixelType >
DomainFunctionType;
typedef
itk::ScalarChanAndVeseDenseLevelSetImageFilter<ImageType,ImageType,
ImageType, LevelSetFunctionType, SharedDataHelperType > MultiLevelSetType;
MultiLevelSetType::Pointer levelSetFilter;
levelSetFilter = MultiLevelSetType::New();
DomainFunctionType::Pointer domainFunction = DomainFunctionType::New();
domainFunction->SetEpsilon( 0.1 );
ImageType::SizeType regionSize;
regionSize[0] = width;
regionSize[1] = height;
ImageType::IndexType regionIndex;
regionIndex[0] = 0;
regionIndex[1] = 0;
ImageType::RegionType region;
region.SetSize(regionSize);
region.SetIndex(regionIndex);
feature->SetBufferedRegion(region);
phi->SetRegions(region);
levelSetFilter->SetFunctionCount( 1 );
levelSetFilter->SetFeatureImage( image );
levelSetFilter->SetLevelSet( 0, phi );
levelSetFilter->SetNumberOfIterations( 100. );
levelSetFilter->SetMaximumRMSError( 0. );
levelSetFilter->SetUseImageSpacing( 1 );
levelSetFilter->SetInPlace( false );
levelSetFilter->GetDifferenceFunction(0)->SetDomainFunction(
domainFunction );
levelSetFilter->GetDifferenceFunction(0)->SetCurvatureWeight( 0. );
levelSetFilter->GetDifferenceFunction(0)->SetAreaWeight( 0. );
levelSetFilter->GetDifferenceFunction(0)->SetReinitializationSmoothingWeight(
0. );
levelSetFilter->GetDifferenceFunction(0)->SetVolumeMatchingWeight( 0. );
levelSetFilter->GetDifferenceFunction(0)->SetVolume( 0. );
levelSetFilter->GetDifferenceFunction(0)->SetLambda1( 2.0 );
levelSetFilter->GetDifferenceFunction(0)->SetLambda2( 1.0 );
QObserver *myCommand = new QObserver();
myCommand->setMax(500);
levelSetFilter->AddObserver(itk::ProgressEvent(), myCommand);
try
{
levelSetFilter->Update();
}
catch( itk::ExceptionObject & excep )
{
std::cerr << "Exception caught !" << std::endl;
std::cerr << excep << std::endl;
} /
--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Level-Set-Chan-and-Vese-with-0-iterations-tp7585074.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users
More information about the Community
mailing list