[prev in list] [next in list] [prev in thread] [next in thread]
List: insight-users
Subject: [ITK-users] Chan and Vese Segmentation for 3D data
From: Param Rajpura <Param.Rajpura () LntTechservices ! com>
Date: 2015-02-10 12:27:21
Message-ID: 8BF3D5D84855AD42BA4EE916729347C2763127 () POCITMSEXMB05 ! LntUniverse ! com
[Download RAW message or body]
Hi all,
I am using ITK for segmentation from 3D MR Images data.
Initially applying ChanandVeseFilter on 2D images I could segment successfully but 3D \
data generates a problem. I am using the same code provided in the example: "Single \
Phase Chan and Vese" the only difference is I am loading fast marching output instead \
of generating here.
I am unable to catch any exceptions here, but while debugging my code, first chance \
exception is thrown at:
1. Inside levelSetFilter->Update();
2. In ImportImageContainer.hxx
3. Line 181, data = new TElement[size];
Below is my code.
typedef itk::ImageFileReader< MainType > ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName("E:\\Intermediate Results\\Sample001_MRI.mhd");
try
{
reader->Update();
}
catch (itk::ExceptionObject & excep)
{
std::cerr << "Exception caught in read !" << \
std::endl; std::cerr << excep << std::endl;
return -1;
}
typedef itk::CastImageFilter<MainType, InternalImageType> \
FloatConversionFilter;
FloatConversionFilter::Pointer ImgTypeConverter = \
FloatConversionFilter::New(); ImgTypeConverter->SetInput(reader->GetOutput());
ImgTypeConverter->Update();
typedef itk::ImageFileWriter< InternalImageType > WriterType;
WriterType::Pointer writer = WriterType::New();
writer->SetFileName("E:\\Intermediate Results\\Out.mhd");
typedef itk::ImageFileReader< InternalImageType > ReaderType1;
ReaderType1::Pointer reader1 = ReaderType1::New();
reader1->SetFileName("E:\\Intermediate Results\\FastMarching.mhd");
reader1->Update();
InternalImageType::Pointer Image = InternalImageType::New();
Image = ImgTypeConverter->GetOutput();
Image->Print(std::cout);
typedef itk::ChangeInformationImageFilter<InternalImageType> \
ChangeFilter; ChangeFilter::Pointer change = ChangeFilter::New();
change->ChangeAll();
change->UseReferenceImageOn();
change->SetReferenceImage(Image);
change->SetInput(reader1->GetOutput());
try
{
change->Update();
}
catch (itk::ExceptionObject & excep)
{
std::cerr << "Exception caught in change !" << \
std::endl; std::cerr << excep << std::endl;
return -1;
}
Image = change->GetOutput();
Image->Print(std::cout);
unsigned int nb_iteration = 1;
double rms = 0.;
double epsilon = 2.;
double curvature_weight = 0.;
double area_weight = 0.;
double reinitialization_weight = 0.;
double volume_weight = 0.5;
double volume = 0.5;
double l1 = 1.;
double l2 = 1.;
double overlap_weight = 100.0;
//
// We now define the image type using a particular pixel type and
// dimension. In this case the \code{float} type is used for the \
pixels // due to the requirements of the smoothing filter.
//
const unsigned int Dimension = 3;
typedef float ScalarPixelType;
typedef itk::Image< ScalarPixelType, Dimension > InternalImageType;
typedef itk::Image< unsigned short, Dimension > MainType;
typedef itk::ScalarChanAndVeseLevelSetFunctionData< \
InternalImageType, InternalImageType > DataHelperType;
typedef itk::ConstrainedRegionBasedLevelSetFunctionSharedData<
InternalImageType, InternalImageType, DataHelperType \
> SharedDataHelperType;
typedef itk::ScalarChanAndVeseLevelSetFunction< InternalImageType,
InternalImageType, SharedDataHelperType > \
LevelSetFunctionType;
// We declare now the type of the numerically discretized Step and \
Delta functions that
// will be used in the level-set computations for foreground and \
background regions //
typedef itk::AtanRegularizedHeavisideStepFunction< ScalarPixelType,
ScalarPixelType > DomainFunctionType;
DomainFunctionType::Pointer domainFunction = \
DomainFunctionType::New(); domainFunction->SetEpsilon(epsilon);
typedef itk::ScalarChanAndVeseSparseLevelSetImageFilter< \
InternalImageType,
InternalImageType, InternalImageType, \
LevelSetFunctionType, SharedDataHelperType > MultiLevelSetType;
MultiLevelSetType::Pointer levelSetFilter = MultiLevelSetType::New();
// We set the function count to 1 since a single level-set is being \
evolved. //
levelSetFilter->SetFunctionCount(1);
// Set the feature image and initial level-set image as output of \
the // fast marching image filter.
//
levelSetFilter->SetFeatureImage(ImgTypeConverter->GetOutput());
levelSetFilter->SetLevelSet(0, change->GetOutput());
//levelSetFilter->SetLevelSet(1, fastMarching1->GetOutput());
// Once activiated the level set evolution will stop if the \
convergence
// criteria or if the maximum number of iterations is reached. The
// convergence criteria is defined in terms of the root mean squared \
(RMS)
// change in the level set function. The evolution is said to have
// converged if the RMS change is below a user specified threshold. \
In a
// real application is desirable to couple the evolution of the zero \
set
// to a visualization module allowing the user to follow the \
evolution of
// the zero set. With this feedback, the user may decide when to \
stop the
// algorithm before the zero set leaks through the regions of low \
gradient
// in the contour of the anatomical structure to be segmented.
//
levelSetFilter->SetNumberOfIterations(nb_iteration);
levelSetFilter->SetMaximumRMSError(rms);
// Often, in real applications, images have different pixel \
resolutions. In such
// cases, it is best to use the native spacings to compute \
derivatives etc rather // than sampling the images.
//
//levelSetFilter->SetUseImageSpacing(1);
// For large images, we may want to compute the level-set over the \
initial supplied // level-set image. This saves a lot of memory.
//
levelSetFilter->SetInPlace(false);
// For the level set with phase 0, set different parameters and \
weights. This may
// to be set in a loop for the case of multiple level-sets evolving \
simultaneously. //
for (unsigned int i = 0; i < 1; i++)
{
\
levelSetFilter->GetDifferenceFunction(i)->SetDomainFunction(domainFunction);
\
levelSetFilter->GetDifferenceFunction(i)->SetCurvatureWeight(curvature_weight);
\
levelSetFilter->GetDifferenceFunction(i)->SetAreaWeight(area_weight);
\
//levelSetFilter->GetDifferenceFunction(i)->SetOverlapPenaltyWeight(overlap_weight);
\
levelSetFilter->GetDifferenceFunction(i)->SetVolumeMatchingWeight(volume_weight);
\
levelSetFilter->GetDifferenceFunction(i)->SetVolume(volume);
\
levelSetFilter->GetDifferenceFunction(i)->SetLambda1(l1);
\
levelSetFilter->GetDifferenceFunction(i)->SetLambda2(l2); }
try
{
levelSetFilter->Update();
}
catch (itk::ExceptionObject & excep)
{
std::cerr << "Exception caught !" << std::endl;
std::cerr << excep << std::endl;
return -1;
}
catch (...)
{
std::cerr << "Exception Caught!!!!!" << std::endl;
return -1;
}
Image = levelSetFilter->GetOutput();
Image->Print(std::cout);
writer->SetInput(levelSetFilter->GetOutput());
writer->Update();
return EXIT_SUCCESS;
}
Also I would like to know what difference it makes when I use 3D data for fast \
marching. By looking at the distance map it doesn't look like a shere centered at the \
given seed point in 3D. And what data should ideally be passed to ChanVese from \
FastMarching for 3D dataset.
Pls help!
Param
L&T Technology Services Ltd
www.LntTechservices.com<http://www.lnttechservices.com/>
This Email may contain confidential or privileged information for the intended \
recipient (s). If you are not the intended recipient, please do not use or \
disseminate the information, notify the sender and delete it from your system.
[Attachment #3 (text/html)]
<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1321346946;
mso-list-type:hybrid;
mso-list-template-ids:-1211566232 67698703 67698713 67698715 67698703 67698713 \
67698715 67698703 67698713 67698715;} @list l0:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hi all,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I am using ITK for segmentation from 3D MR Images \
data.<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Initially applying ChanandVeseFilter on 2D images I could \
segment successfully but 3D data generates a problem.<o:p></o:p></p> <p \
class="MsoNormal">I am using the same code provided in the example: “Single \
Phase Chan and Vese” the only difference is I am loading fast marching output \
instead of generating here.<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I am unable to catch any exceptions here, but while debugging my \
code, first chance exception is thrown at:<o:p></o:p></p> <p \
class="MsoNormal"><o:p> </o:p></p> <p class="MsoListParagraph" \
style="text-indent:-.25in;mso-list:l0 level1 lfo1"><![if !supportLists]><span \
style="mso-list:Ignore">1.<span style="font:7.0pt "Times New \
Roman""> </span></span><![endif]>Inside \
levelSetFilter->Update();<o:p></o:p></p> <p class="MsoListParagraph" \
style="text-indent:-.25in;mso-list:l0 level1 lfo1"><![if !supportLists]><span \
style="mso-list:Ignore">2.<span style="font:7.0pt "Times New \
Roman""> </span></span><![endif]>In \
ImportImageContainer.hxx<o:p></o:p></p> <p class="MsoListParagraph" \
style="text-indent:-.25in;mso-list:l0 level1 lfo1"><![if !supportLists]><span \
style="mso-list:Ignore">3.<span style="font:7.0pt "Times New \
Roman""> </span></span><![endif]>Line 181, \
data = new TElement[size];<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Below is my code.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> \
<o:p></o:p></p> <p class="MsoNormal"> \
typedef itk::ImageFileReader< MainType > ReaderType;<o:p></o:p></p> <p \
class="MsoNormal"> \
ReaderType::Pointer reader = ReaderType::New();<o:p></o:p></p> <p \
class="MsoNormal"> \
reader->SetFileName("E:\\Intermediate \
Results\\Sample001_MRI.mhd");<o:p></o:p></p> <p \
class="MsoNormal"> \
try<o:p></o:p></p> <p \
class="MsoNormal"> \
{<o:p></o:p></p> <p class="MsoNormal"> \
\
reader->Update();<o:p></o:p></p> <p \
class="MsoNormal"> \
}<o:p></o:p></p> <p class="MsoNormal"> \
catch (itk::ExceptionObject & excep)<o:p></o:p></p> <p \
class="MsoNormal"> \
{<o:p></o:p></p> <p class="MsoNormal"> \
\
std::cerr << "Exception caught in read !" << \
std::endl;<o:p></o:p></p> <p \
class="MsoNormal"> &n \
bsp; \
std::cerr << excep << std::endl;<o:p></o:p></p> <p \
class="MsoNormal"> &n \
bsp; \
return -1;<o:p></o:p></p> <p \
class="MsoNormal"> \
}<o:p></o:p></p> <p class="MsoNormal"> \
typedef itk::CastImageFilter<MainType, InternalImageType> \
FloatConversionFilter;<o:p></o:p></p> <p \
class="MsoNormal"> \
FloatConversionFilter::Pointer ImgTypeConverter = \
FloatConversionFilter::New();<o:p></o:p></p> <p \
class="MsoNormal"> \
ImgTypeConverter->SetInput(reader->GetOutput());<o:p></o:p></p> <p \
class="MsoNormal"> \
ImgTypeConverter->Update();<o:p></o:p></p> <p \
class="MsoNormal"><o:p> </o:p></p> <p \
class="MsoNormal"> \
typedef itk::ImageFileWriter< InternalImageType > WriterType;<o:p></o:p></p> <p \
class="MsoNormal"> \
WriterType::Pointer writer = WriterType::New();<o:p></o:p></p> <p \
class="MsoNormal"> \
writer->SetFileName("E:\\Intermediate Results\\Out.mhd");<o:p></o:p></p> \
<p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> \
typedef itk::ImageFileReader< InternalImageType > ReaderType1;<o:p></o:p></p> \
<p class="MsoNormal"> \
ReaderType1::Pointer reader1 = ReaderType1::New();<o:p></o:p></p> <p \
class="MsoNormal"> \
reader1->SetFileName("E:\\Intermediate \
Results\\FastMarching.mhd");<o:p></o:p></p> <p \
class="MsoNormal"> \
reader1->Update();<o:p></o:p></p> <p \
class="MsoNormal"> \
InternalImageType::Pointer Image = InternalImageType::New();<o:p></o:p></p> <p \
class="MsoNormal"> \
Image = ImgTypeConverter->GetOutput();<o:p></o:p></p> <p \
class="MsoNormal"> \
Image->Print(std::cout);<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> \
typedef itk::ChangeInformationImageFilter<InternalImageType> \
ChangeFilter;<o:p></o:p></p> <p \
class="MsoNormal"> \
ChangeFilter::Pointer change = ChangeFilter::New();<o:p></o:p></p> <p \
class="MsoNormal"> \
change->ChangeAll();<o:p></o:p></p> <p \
class="MsoNormal"> \
change->UseReferenceImageOn();<o:p></o:p></p> <p \
class="MsoNormal"> \
change->SetReferenceImage(Image);<o:p></o:p></p> <p \
class="MsoNormal"> \
change->SetInput(reader1->GetOutput());<o:p></o:p></p> <p \
class="MsoNormal"> \
try<o:p></o:p></p> <p \
class="MsoNormal"> \
{<o:p></o:p></p> <p class="MsoNormal"> \
\
change->Update();<o:p></o:p></p> <p \
class="MsoNormal"> \
}<o:p></o:p></p> <p class="MsoNormal"> \
catch (itk::ExceptionObject & excep)<o:p></o:p></p> <p \
class="MsoNormal"> \
{<o:p></o:p></p> <p class="MsoNormal"> \
\
std::cerr << "Exception caught in change !" << \
std::endl;<o:p></o:p></p> <p \
class="MsoNormal"> &n \
bsp; \
std::cerr << excep << std::endl;<o:p></o:p></p> <p \
class="MsoNormal"> &n \
bsp; \
return -1;<o:p></o:p></p> <p \
class="MsoNormal"> \
}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> \
Image = change->GetOutput();<o:p></o:p></p> <p \
class="MsoNormal"> \
Image->Print(std::cout);<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> \
<o:p></o:p></p> <p class="MsoNormal"> \
unsigned int nb_iteration = 1;<o:p></o:p></p> <p \
class="MsoNormal"> \
double rms = 0.;<o:p></o:p></p> <p \
class="MsoNormal"> \
double epsilon = 2.;<o:p></o:p></p> <p \
class="MsoNormal"> \
double curvature_weight = 0.;<o:p></o:p></p> <p \
class="MsoNormal"> \
double area_weight = 0.;<o:p></o:p></p> <p \
class="MsoNormal"> \
double reinitialization_weight = 0.;<o:p></o:p></p> <p \
class="MsoNormal"> \
double volume_weight = 0.5;<o:p></o:p></p> <p \
class="MsoNormal"> \
double volume = 0.5;<o:p></o:p></p> <p \
class="MsoNormal"> \
double l1 = 1.;<o:p></o:p></p> <p \
class="MsoNormal"> \
double l2 = 1.;<o:p></o:p></p> <p \
class="MsoNormal"> \
double overlap_weight = 100.0;<o:p></o:p></p> <p \
class="MsoNormal"> \
//<o:p></o:p></p> <p \
class="MsoNormal"> \
// We now define the image type using a particular pixel type \
and<o:p></o:p></p> <p \
class="MsoNormal"> \
// dimension. In this case the \code{float} type is used for the \
pixels<o:p></o:p></p> <p \
class="MsoNormal"> \
// due to the requirements of the smoothing filter.<o:p></o:p></p> <p \
class="MsoNormal"> \
//<o:p></o:p></p> <p \
class="MsoNormal"> \
const unsigned int Dimension = 3;<o:p></o:p></p> <p \
class="MsoNormal"> \
typedef float ScalarPixelType;<o:p></o:p></p> <p \
class="MsoNormal"> \
typedef itk::Image< ScalarPixelType, Dimension > \
InternalImageType;<o:p></o:p></p> <p \
class="MsoNormal"> \
typedef itk::Image< unsigned short, Dimension > MainType;<o:p></o:p></p> <p \
class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> \
typedef itk::ScalarChanAndVeseLevelSetFunctionData< \
InternalImageType,<o:p></o:p></p> <p \
class="MsoNormal"> &n \
bsp; \
InternalImageType > DataHelperType;<o:p></o:p></p> <p \
class="MsoNormal"><o:p> </o:p></p> <p \
class="MsoNormal"> \
typedef itk::ConstrainedRegionBasedLevelSetFunctionSharedData<<o:p></o:p></p> <p \
class="MsoNormal"> &n \
bsp; \
InternalImageType, InternalImageType, DataHelperType > \
SharedDataHelperType;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> \
typedef itk::ScalarChanAndVeseLevelSetFunction< InternalImageType,<o:p></o:p></p> \
<p class="MsoNormal">   \
; \
InternalImageType, SharedDataHelperType > LevelSetFunctionType;<o:p></o:p></p> <p \
class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> \
// We declare now the type of the numerically discretized Step and Delta \
functions that<o:p></o:p></p> <p \
class="MsoNormal"> \
// will be used in the level-set computations for foreground and background \
regions<o:p></o:p></p> <p \
class="MsoNormal"> \
//<o:p></o:p></p> <p \
class="MsoNormal"> \
typedef itk::AtanRegularizedHeavisideStepFunction< ScalarPixelType,<o:p></o:p></p> \
<p class="MsoNormal">   \
; \
ScalarPixelType > DomainFunctionType;<o:p></o:p></p> <p \
class="MsoNormal"><o:p> </o:p></p> <p \
class="MsoNormal"> \
DomainFunctionType::Pointer domainFunction = \
DomainFunctionType::New();<o:p></o:p></p> <p \
class="MsoNormal"> \
domainFunction->SetEpsilon(epsilon);<o:p></o:p></p> <p \
class="MsoNormal"><o:p> </o:p></p> <p \
class="MsoNormal"> \
<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> \
typedef itk::ScalarChanAndVeseSparseLevelSetImageFilter< \
InternalImageType,<o:p></o:p></p> <p \
class="MsoNormal"> &n \
bsp; \
InternalImageType, InternalImageType, LevelSetFunctionType,<o:p></o:p></p> <p \
class="MsoNormal"> &n \
bsp; \
SharedDataHelperType > MultiLevelSetType;<o:p></o:p></p> <p \
class="MsoNormal"><o:p> </o:p></p> <p \
class="MsoNormal"> \
MultiLevelSetType::Pointer levelSetFilter = MultiLevelSetType::New();<o:p></o:p></p> \
<p class="MsoNormal"><o:p> </o:p></p> <p \
class="MsoNormal"> \
// We set the function count to 1 since a single level-set is being \
evolved.<o:p></o:p></p> <p \
class="MsoNormal"> \
//<o:p></o:p></p> <p \
class="MsoNormal"> \
levelSetFilter->SetFunctionCount(1);<o:p></o:p></p> <p \
class="MsoNormal"><o:p> </o:p></p> <p \
class="MsoNormal"> \
// Set the feature image and initial level-set image as output of \
the<o:p></o:p></p> <p \
class="MsoNormal"> \
// fast marching image filter.<o:p></o:p></p> <p \
class="MsoNormal"> \
//<o:p></o:p></p> <p \
class="MsoNormal"> \
levelSetFilter->SetFeatureImage(ImgTypeConverter->GetOutput());<o:p></o:p></p> \
<p class="MsoNormal"> \
levelSetFilter->SetLevelSet(0, change->GetOutput());<o:p></o:p></p> <p \
class="MsoNormal"> \
//levelSetFilter->SetLevelSet(1, fastMarching1->GetOutput());<o:p></o:p></p> <p \
class="MsoNormal"> \
// Once activiated the level set evolution will stop if the \
convergence<o:p></o:p></p> <p \
class="MsoNormal"> \
// criteria or if the maximum number of iterations is reached. \
The<o:p></o:p></p> <p \
class="MsoNormal"> \
// convergence criteria is defined in terms of the root mean squared \
(RMS)<o:p></o:p></p> <p \
class="MsoNormal"> \
// change in the level set function. The evolution is said to \
have<o:p></o:p></p> <p \
class="MsoNormal"> \
// converged if the RMS change is below a user specified threshold. In \
a<o:p></o:p></p> <p class="MsoNormal"> \
// real application is desirable to couple the evolution of the zero \
set<o:p></o:p></p> <p \
class="MsoNormal"> \
// to a visualization module allowing the user to follow the evolution \
of<o:p></o:p></p> <p \
class="MsoNormal"> \
// the zero set. With this feedback, the user may decide when to stop \
the<o:p></o:p></p> <p \
class="MsoNormal"> \
// algorithm before the zero set leaks through the regions of low \
gradient<o:p></o:p></p> <p \
class="MsoNormal"> \
// in the contour of the anatomical structure to be segmented.<o:p></o:p></p> \
<p class="MsoNormal"> \
//<o:p></o:p></p> <p \
class="MsoNormal"> \
levelSetFilter->SetNumberOfIterations(nb_iteration);<o:p></o:p></p> <p \
class="MsoNormal"> \
levelSetFilter->SetMaximumRMSError(rms);<o:p></o:p></p> <p \
class="MsoNormal"> \
// Often, in real applications, images have different pixel resolutions. In \
such<o:p></o:p></p> <p \
class="MsoNormal"> \
// cases, it is best to use the native spacings to compute derivatives etc \
rather<o:p></o:p></p> <p \
class="MsoNormal"> \
// than sampling the images.<o:p></o:p></p> <p \
class="MsoNormal"> \
//<o:p></o:p></p> <p \
class="MsoNormal"> \
//levelSetFilter->SetUseImageSpacing(1);<o:p></o:p></p> <p \
class="MsoNormal"><o:p> </o:p></p> <p \
class="MsoNormal"> \
// For large images, we may want to compute the level-set over the initial \
supplied<o:p></o:p></p> <p \
class="MsoNormal"> \
// level-set image. This saves a lot of memory.<o:p></o:p></p> <p \
class="MsoNormal"> \
//<o:p></o:p></p> <p \
class="MsoNormal"> \
levelSetFilter->SetInPlace(false);<o:p></o:p></p> <p \
class="MsoNormal"> \
// For the level set with phase 0, set different parameters and weights. This \
may<o:p></o:p></p> <p \
class="MsoNormal"> \
// to be set in a loop for the case of multiple level-sets evolving \
simultaneously.<o:p></o:p></p> <p \
class="MsoNormal"> \
//<o:p></o:p></p> <p \
class="MsoNormal"> \
<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> \
for (unsigned int i = 0; i < 1; i++)<o:p></o:p></p> <p \
class="MsoNormal"> \
{<o:p></o:p></p> <p class="MsoNormal"> \
\
levelSetFilter->GetDifferenceFunction(i)->SetDomainFunction(domainFunction);<o:p></o:p></p>
<p class="MsoNormal"> &nbs \
p; \
levelSetFilter->GetDifferenceFunction(i)->SetCurvatureWeight(curvature_weight);<o:p></o:p></p>
<p class="MsoNormal"> &nbs \
p; \
levelSetFilter->GetDifferenceFunction(i)->SetAreaWeight(area_weight);<o:p></o:p></p>
<p class="MsoNormal"> &nbs \
p; \
//levelSetFilter->GetDifferenceFunction(i)->SetOverlapPenaltyWeight(overlap_weight);<o:p></o:p></p>
<p class="MsoNormal"> &nbs \
p; \
levelSetFilter->GetDifferenceFunction(i)->SetVolumeMatchingWeight(volume_weight);<o:p></o:p></p>
<p class="MsoNormal"> &nbs \
p; \
levelSetFilter->GetDifferenceFunction(i)->SetVolume(volume);<o:p></o:p></p> <p \
class="MsoNormal"> &n \
bsp; \
levelSetFilter->GetDifferenceFunction(i)->SetLambda1(l1);<o:p></o:p></p> <p \
class="MsoNormal"> &n \
bsp; \
levelSetFilter->GetDifferenceFunction(i)->SetLambda2(l2);<o:p></o:p></p> <p \
class="MsoNormal"> \
}<o:p></o:p></p> <p class="MsoNormal"> \
<o:p></o:p></p> <p class="MsoNormal"> \
try<o:p></o:p></p> <p \
class="MsoNormal"> \
{<o:p></o:p></p> <p class="MsoNormal"> \
\
levelSetFilter->Update();<o:p></o:p></p> <p \
class="MsoNormal"> \
}<o:p></o:p></p> <p class="MsoNormal"> \
catch (itk::ExceptionObject & excep)<o:p></o:p></p> <p \
class="MsoNormal"> \
{<o:p></o:p></p> <p class="MsoNormal"> \
\
std::cerr << "Exception caught !" << std::endl;<o:p></o:p></p> \
<p class="MsoNormal"> \
\
std::cerr << excep << std::endl;<o:p></o:p></p> <p \
class="MsoNormal"> &n \
bsp; \
return -1;<o:p></o:p></p> <p \
class="MsoNormal"> \
}<o:p></o:p></p> <p class="MsoNormal"> \
catch (...)<o:p></o:p></p> <p \
class="MsoNormal"> \
{<o:p></o:p></p> <p class="MsoNormal"> \
\
std::cerr << "Exception Caught!!!!!" << \
std::endl;<o:p></o:p></p> <p \
class="MsoNormal"> &n \
bsp; \
return -1;<o:p></o:p></p> <p \
class="MsoNormal"> \
}<o:p></o:p></p> <p class="MsoNormal"> \
Image = levelSetFilter->GetOutput();<o:p></o:p></p> <p \
class="MsoNormal"> \
Image->Print(std::cout);<o:p></o:p></p> <p \
class="MsoNormal"> \
writer->SetInput(levelSetFilter->GetOutput());<o:p></o:p></p> <p \
class="MsoNormal"> \
writer->Update();<o:p></o:p></p> <p \
class="MsoNormal"> \
return EXIT_SUCCESS;<o:p></o:p></p> <p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal">Also I would like to know what difference it makes when I use 3D \
data for fast marching. By looking at the distance map it doesn’t look like a \
shere centered at the given seed point in 3D.<o:p></o:p></p> <p class="MsoNormal">And \
what data should ideally be passed to ChanVese from FastMarching for 3D \
dataset.<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Pls help!<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Param<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p><strong>L&T Technology Services Ltd</strong></p>
<p><a href="http://www.lnttechservices.com/" \
target="_blank">www.LntTechservices.com</a></p> <p>This Email may contain \
confidential or privileged information for the intended recipient (s). If you are not \
the intended recipient, please do not use or disseminate the information, notify the \
sender and delete it from your system.</p> </body>
</html>
_____________________________________
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://public.kitware.com/mailman/listinfo/insight-users
--===============2074480631==--
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic