<table cellspacing="0" cellpadding="0" border="0"><tr><td valign="top"><p dir="ltr">Hi,<br>
The strange thing is that in debug mode (both ITK that my code) it works fine.</p>
</td></tr></table>            <div id="_origMsg_">
                <div>
                    <br />
                    <div>
                        <div style="font-size:0.9em">
                            <hr size="1">
                            <b>
                                <span style="font-weight:bold">From:</span>
                            </b>
                            Bradley Lowekamp &lt;blowekamp@mail.nih.gov&gt;;                            <br>
                            <b>
                                <span style="font-weight:bold">To:</span>
                            </b>
                            Paolo Zaffino &lt;p.zaffino@yahoo.it&gt;;                                                     <br>
                            <b>
                                <span style="font-weight:bold">Cc:</span>
                            </b>
                            Bill Lorensen &lt;bill.lorensen@gmail.com&gt;; insight-users@itk.org &lt;insight-users@itk.org&gt;;                                                                             <br>
                            <b>
                                <span style="font-weight:bold">Subject:</span>
                            </b>
                            Re: [Insight-users] itkImageMaskSpatialObject segmentation fault                            <br>
                            <b>
                                <span style="font-weight:bold">Sent:</span>
                            </b>
                            Thu, Jun 27, 2013 11:17:06 PM                            <br>
                        </div>
                            <br>
                            <table cellspacing="0" cellpadding="0" border="0">
                                <tbody>
                                    <tr>
                                        <td valign="top">Hello,<div><br></div><div>I don&#39;t see anything obviously wrong with your code, but I haven&#39;t recently used that class myself.</div><div><br></div><div>Do you know how to run the program in &nbsp;gdb to determine where the segfault is happening? A stack trace is quite useful for tracking down this type of error.</div><div><br></div><div>Brad</div><div><br></div><div><div><div>On Jun 27, 2013, at 1:43 PM, Paolo Zaffino &lt;<a rel="nofollow" ymailto="mailto:p.zaffino@yahoo.it" target="_blank" href="javascript:return">p.zaffino@yahoo.it</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
 
  
  <div>
    <div class="moz-cite-prefix">The problem is not in the
      reader-&gt;Update() but in<br>
      mask-&gt;SetImage(reader-&gt;GetOutput());<br>
      <br>
      Until this row it is ok.<br>
      <br>
      <br>
      <br>
      <br>
      On 27/06/2013 16:37, Bill Lorensen wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">You should put a try/catch around
        reader-&gt;Update(). It may provide for information.<br>
        <br>
        <a rel="nofollow" target="_blank" href="http://itk.org/Wiki/ITK/Examples/SimpleOperations/TryCatch">http://itk.org/Wiki/ITK/Examples/SimpleOperations/TryCatch</a><br>
        <br>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Thu, Jun 27, 2013 at 4:25 PM, Paolo
          Zaffino <span dir="ltr">&lt;<a rel="nofollow" ymailto="mailto:p.zaffino@yahoo.it" target="_blank" href="javascript:return">p.zaffino@yahoo.it</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Dear ITK
            community,<br>
            I&#39;m facing a strange ITK behavior.<br>
            I wrote this code:<br>
            <br>
            #include &quot;itkImage.h&quot;<br>
            #include &quot;itkImageFileReader.h&quot;<br>
            #include &quot;itkImageMaskSpatialObject.h&quot;<br>
            <br>
            int main( int argc, char **argv )<br>
            {<br>
            &nbsp; typedef itk::Image&lt;unsigned char,3&gt; ImageType;<br>
            &nbsp; typedef itk::ImageFileReader&lt;ImageType&gt; ReaderType;<br>
            <br>
            &nbsp; typedef itk::ImageMaskSpatialObject&lt;3&gt;
            MaskImageType;<br>
            &nbsp; typedef MaskImageType::Pointer MaskTypePointer;<br>
            <br>
            &nbsp; ReaderType::Pointer reader = ReaderType::New();<br>
            <br>
            &nbsp; reader-&gt;SetFileName( argv[1] );<br>
            &nbsp; reader-&gt;Update();<br>
            <br>
            &nbsp; MaskTypePointer mask = MaskImageType::New();<br>
            &nbsp; mask-&gt;SetImage(reader-&gt;GetOutput());<br>
            <br>
            &nbsp; return 0;<br>
            }<br>
            <br>
            and it compiles without error.<br>
            When I try to run the executable I get a segmentation error
            (core dumped).<br>
            What&#39;s is wrong?<br>
            I&#39;m using ITK 3.20.1 on a 64 bit Linux box.<br>
            If needed I can provide the mask image.<br>
            <br>
            Thanks a lot for your help.<br>
            Best regards.<br>
            Paolo<br>
            _____________________________________<br>
            Powered by <a rel="nofollow" target="_blank" href="http://www.kitware.com/">www.kitware.com</a><br>
            <br>
            Visit other Kitware open-source projects at<br>
            <a rel="nofollow" target="_blank" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>
            <br>
            Kitware offers ITK Training Courses, for more information
            visit:<br>
            <a rel="nofollow" target="_blank" href="http://www.kitware.com/products/protraining.php">http://www.kitware.com/products/protraining.php</a><br>
            <br>
            Please keep messages on-topic and check the ITK FAQ at:<br>
            <a rel="nofollow" target="_blank" href="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</a><br>
            <br>
            Follow this link to subscribe/unsubscribe:<br>
            <a rel="nofollow" target="_blank" href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a><br>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <br>
        -- <br>
        Unpaid intern in BillsBasement at noware dot com<br>
      </div>
    </blockquote>
    <br>
  </div>

_____________________________________<br>Powered by <a rel="nofollow" target="_blank" href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a rel="nofollow" target="_blank" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.php<br><br>Please keep messages on-topic and check the ITK FAQ at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.itk.org/mailman/listinfo/insight-users<br></blockquote></div><br></div></td>
                                    </tr>
                                </tbody>
                            </table>
                    </div>
                </div>
            </div>