<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV>Dear Amardeep:</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV>
<DIV> </DIV>
<DIV>After I called</DIV><BR></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> geodesicActiveContour->SetAdvectionImage(castflowfilter->GetOutput()); </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">Do I need to call GenerateAdvectioniImage() since Atumatic Generate is set off.</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">After I add : geodesicActiveContour->GenerateAdvectionImage();</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">I still got error, please give me some suggestions.</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">Baoyun<BR></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><FONT face=Tahoma size=2>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Baoyun Li <baoyun_li123@yahoo.com><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Amardeep Singh <amar.singh@gmx.de><BR><B><SPAN style="FONT-WEIGHT: bold">Cc:</SPAN></B> insight-users@itk.org<BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Thursday, March 5, 2009 3:25:12 PM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Segmenation Error--after set advection image by GVF flow<BR></FONT><BR>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV>Dear Amardeep and All:</DIV>
<DIV> </DIV>
<DIV>Now I can build the program after seting advection image by GVF flow. However, when I run the program, the program shows segmeation error when geodesicActiveContour->Update();<BR></DIV>
<DIV>The program stop at: itkSegmentationLevelSetFunction_txx at return ( m_AdvectionImage->GetPixel(idx) );<BR></DIV>
<DIV> </DIV>
<DIV>template <class TImageType, class TFeatureImageType><BR>typename SegmentationLevelSetFunction<TImageType, TFeatureImageType>::VectorType<BR>SegmentationLevelSetFunction<TImageType, TFeatureImageType><BR>::AdvectionField(const NeighborhoodType &neighborhood,<BR> const FloatOffsetType &offset, GlobalDataStruct *) const<BR>{<BR> IndexType idx = neighborhood.GetIndex();<BR> ContinuousIndexType cdx;<BR> for (unsigned i = 0; i < ImageDimension; ++i)<BR> {<BR> cdx[i] = static_cast<double>(idx[i]) - offset[i];<BR> }<BR> if ( m_VectorInterpolator->IsInsideBuffer(cdx) )<BR> {<BR> return ( m_VectorCast(m_VectorInterpolator->EvaluateAtContinuousIndex(cdx)));<BR> }<BR> //Just return the
default else<BR> return ( m_AdvectionImage->GetPixel(idx) );<BR> <BR>}</DIV>
<DIV> </DIV>
<DIV>Clearly, something is still wrong with SetAdvectionImage. Below is related code.</DIV>
<DIV> </DIV>
<DIV>Can you please help me figure out which setting is wrong? </DIV>
<DIV> </DIV>
<DIV>Thanks</DIV>
<DIV> </DIV>
<DIV>Baoyun</DIV>
<DIV><BR> </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> typedef itk::CovariantVector<double, Dim> myGradientType;<BR> typedef itk::Image<myGradientType, Dim> myGradientImageType;</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> typedef itk::GradientVectorFlowImageFilter<myGradientImageType, myGradientImageType><BR> myGVFFilterType;</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> typedef itk::GradientImageFilter<DoublelImageType, double,double><BR> myGFilterType;</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> typedef itk::GradientToMagnitudeImageFilter<myGradientImageType, DoublelImageType><BR> myGToMFilterType;</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><BR> typedef itk::GradientRecursiveGaussianImageFilter<<BR> DoublelImageType,<BR>
myGradientImageType<BR> > myFilterType;<BR> typedef typename GeodesicActiveContourFilterType::VectorImageType AdvectionImageType; <BR> typedef itk::CastImageFilter<myGradientImageType,AdvectionImageType> <BR> CastFlowFilterType;<BR> typedef itk::LaplacianImageFilter<DoublelImageType, DoublelImageType> myLaplacianFilterType;<BR> typename myFilterType::Pointer filter = myFilterType::New();<BR> typename myGFilterType::Pointer gfilter = myGFilterType::New();<BR> typename myGToMFilterType::Pointer gtomfilter = myGToMFilterType::New();<BR> typename myLaplacianFilterType::Pointer
m_LFilter = myLaplacianFilterType::New();<BR> typename myGVFFilterType::Pointer m_GVFFilter = myGVFFilterType::New();<BR> typename CastFlowFilterType::Pointer castflowfilter = CastFlowFilterType::New(); </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> typedef itk::ImageFileWriter< myGradientImageType > WriterType2;<BR> typename WriterType2::Pointer writer21=WriterType2::New(); <BR> </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><BR> typename WriterType1::Pointer writer4=WriterType1::New();<BR> writer4->SetInput(caster11->GetOutput());<BR> writer4->SetFileName("../data/intial_contour.hdr");<BR> writer4->Update();</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><BR> sigmoid->SetOutputMinimum( 0.0 );<BR> sigmoid->SetOutputMaximum( 1.0 );<BR> caster12->SetInput(inputfilter);<BR> smoothing->SetInput(caster12->GetOutput() );<BR> gradientMagnitude->SetInput( smoothing->GetOutput() );<BR> sigmoid->SetInput( gradientMagnitude->GetOutput() );</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> caster31->SetInput(inputfilter);<BR> filter->SetInput( caster31->GetOutput() ); //caster short to double<BR> filter->SetSigma( 1.0);<BR> filter->Update();<BR> gtomfilter->SetInput(filter->GetOutput());<BR> gtomfilter->Update();<BR> gfilter->SetInput(gtomfilter->GetOutput());<BR> gfilter->Update();<BR> m_GVFFilter->SetInput(gfilter->GetOutput());<BR> m_GVFFilter->SetLaplacianFilter(m_LFilter);<BR> m_GVFFilter->SetNoiseLevel(500);<BR> m_GVFFilter->SetTimeStep(0.05);<BR> m_GVFFilter->SetIterationNum(5);<BR> m_GVFFilter->Update();<BR> writer21->SetInput(m_GVFFilter->GetOutput());<BR> writer21->SetFileName("../data/GVF_flow.hdr");<BR> writer21->Update();<BR>//to get gradient manitude of GVF low</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> <BR> geodesicActiveContour->SetAutoGenerateSpeedAdvection(false);<BR> //typename myGradientImageType::Pointer m_GVFField; <BR> //m_GVFField = m_GVFFilter->GetOutput();<BR> castflowfilter->SetInput(m_GVFFilter->GetOutput()); <BR> geodesicActiveContour->SetAdvectionImage(castflowfilter->GetOutput()); <BR> // geodesicActiveContour->GenerateSpeedImage(); <BR> //geodesicActiveContour->SetAdvectionImage(m_GVFFilter->GetOutput()); </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> <BR> <BR> </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> <BR> geodesicActiveContour->SetInput( caster11->GetOutput() );<BR> geodesicActiveContour->SetFeatureImage( sigmoid->GetOutput() );<BR> geodesicActiveContour->GenerateSpeedImage(); <BR> geodesicActiveContour->Update();<BR> thresholder->SetInput( geodesicActiveContour->GetOutput() );<BR> thresholder->Update();<BR> outputfilter=thresholder->GetOutput();<BR></DIV></DIV><BR></DIV></DIV><BR></DIV></DIV></div><br>
</body></html>