<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
I have to put<br> int main(...)<br>at the beginning and then it runs perfectly... I don't know how, but the first time that I tried that way it doesn't work...maybe I did something different...<br><br>But now I'm trying to run only a part of code... I would like to use only itk::ConnectedComponentImageFilter, but I have Segmentation fault...;-(<br><br>This is my code:<br>------------------------------------------------------------------------------------------------------------------------------<br><br>#include "itkConnectedComponentImageFilter.h"<br><br>#include "itkImageFileReader.h"<br>#include "itkImageFileWriter.h"<br><br>int main(int argc, char* argv[] )<br>{<br> if( argc < 3 )<br> {<br> std::cerr << "Missing Parameters " << std::endl;<br> std::cerr << "Usage: " << argv[0];<br> std::cerr << " inputImage outputImage" << std::endl;<br> return EXIT_FAILURE;<br> }<br><br> typedef unsigned short InternalPixelType;<br> const unsigned int Dimension = 3;<br> <br> typedef itk::Image< InternalPixelType, Dimension > InternalImageType;<br> <br> typedef itk::ImageFileReader< InternalImageType > ReaderType;<br> typedef itk::ImageFileWriter< InternalImageType > WriterType; <br><br> typedef itk::ConnectedComponentImageFilter< InternalImageType, InternalImageType > FilterType;<br><br> ReaderType::Pointer reader = ReaderType::New();<br> WriterType::Pointer writer = WriterType::New();<br> <br> FilterType::Pointer filter = FilterType::New();<br><br> reader->SetFileName( argv[1] );<br><br><br> filter->SetInput (reader->GetOutput()); <br> filter->Update();<br> <br><br> try<br> {<br> writer->SetInput (filter->GetOutput()); <br> writer->SetFileName( argv[2] );<br> writer->Update();<br> }<br> catch( itk::ExceptionObject & excep )<br> {<br> std::cerr << "Exception caught !" << std::endl;<br> std::cerr << excep << std::endl;<br> }<br><br><br> return EXIT_SUCCESS;<br><br>}<br><br>-----------------------------------------------------------------------<br>I thing there is some stupid error but I don't find it....<br><br><hr id="stopSpelling">From: arpit392@gmail.com<br>Date: Thu, 26 Aug 2010 14:47:23 +0530<br>Subject: Re: [Insight-users] Matlab bwlabeln in itk<br>To: danysunflower@hotmail.it<br><br>what was it??<br><br><div class="ecxgmail_quote">On Thu, Aug 26, 2010 at 2:45 PM, Daniela Sacchetto <span dir="ltr"><<a href="mailto:danysunflower@hotmail.it">danysunflower@hotmail.it</a>></span> wrote:<br><blockquote class="ecxgmail_quote" style="border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>
Ok, I find my error!!! It was a little stupid... <br>Thanks all for your help<br><br>Regards<div class="ecxim"><br>Daniela<br><br><hr>From: <a href="mailto:arpit392@gmail.com">arpit392@gmail.com</a><br></div>
Date: Thu, 26 Aug 2010 14:22:18 +0530<div><div></div><div class="h5"><br>Subject: Re: [Insight-users] Matlab bwlabeln in itk<br>To: <a href="mailto:danysunflower@hotmail.it">danysunflower@hotmail.it</a><br>
<br>I guess you didnt change "int itkConnectedComponentImageFilterTest(int argc, char* argv[] )" to "int main( int argc, char* argv[])".....<div><br></div><div>thats a testing codes...you need to make a few changes before u run them....</div>
<div><br></div><div><div><br><div>On Thu, Aug 26, 2010 at 1:41 PM, Daniela Sacchetto <span dir="ltr"><<a href="mailto:danysunflower@hotmail.it">danysunflower@hotmail.it</a>></span> wrote:<br><blockquote style="padding-left: 1ex;">
<div>
Hi, firstly, thank you for your reply.<br><br>I'm trying to run the code you suggested me to understand how it works but I find a problem that I've never had and that it a little strange in my opinion.<br>This is the error that I have:<br>
<br>/usr/lib/gcc/i486-linux-gnu/4.4.1/../../../../lib/crt1.o: In function `_start':<br>/build/buildd/eglibc-2.10.1/csu/../sysdeps/i386/elf/start.S:115: undefined reference to `main'<br>collect2: ld returned 1 exit status<br>
<br>What does it mean?<br>Could you help me?<br>Thanks<br><font color="#888888">Daniela<br></font><div><br><br><br><hr>From: <a href="mailto:arpit392@gmail.com">arpit392@gmail.com</a><br>Date: Thu, 26 Aug 2010 13:23:16 +0530<br>
Subject: Re: [Insight-users] Matlab bwlabeln in itk<br>To: <a href="mailto:danysunflower@hotmail.it">danysunflower@hotmail.it</a></div><div><div></div><div><br><br>u can use itkConnectedComponentImageFilterTest.cxx, it performs a similar task...except it associates each label with a different colour, to help visualize the different parts using itkRelabelComponentImageFilter, you can comment this part to get your desired results...<div>
<br></div><div>Cheers,</div><div>Arpit<br><br><div>On Thu, Aug 26, 2010 at 1:15 PM, Daniela Sacchetto <span dir="ltr"><<a href="mailto:danysunflower@hotmail.it">danysunflower@hotmail.it</a>></span> wrote:<br>
<blockquote style="padding-left: 1ex;">
<div>
Hi everyone,<br>I need your help.<br><br>I have to implement a code with similar function to Matlab bwlabeln; Matlab's routine <code>L = bwlabeln(BW)</code> returns a label matrix <code>L</code> containing labels for the connected components in <code>BW</code>; the elements of <code>L</code> are integer values greater than or equal to 0. The pixels labeled 0 are the background.<br>
<br>I looked for similar itk method in itk User's Guide but I didn't find anything... could anyone help me?<br><br>Thanks of all,<br>Daniela<br>                                            </div>
<br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Arpit Agrawal<br>Junior Undergraduate, <br>Dual Degree Communication and Signal Processing ,<br>Dept. of Electrical Engg, IITB.<br>
</div>                                            </div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br>Arpit Agrawal<br>Junior Undergraduate, <br>Dual Degree Communication and Signal Processing ,<br>Dept. of Electrical Engg, IITB.<br>
</div></div>                                            </div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br>Arpit Agrawal<br>Junior Undergraduate, <br>Dual Degree Communication and Signal Processing ,<br>Dept. of Electrical Engg, IITB.<br>                                            </body>
</html>