Hi,<br>I try to use a extract an image slice of a 3D dataset in a function in c++. I read <a href="http://www.itk.org/pipermail/insight-users/2004-November/011095.html">this site</a> where Luis describes how to use an image in a function but I was not able to write my function...<br>
I define the 3D dataset in the main program and want to extract the slice in a function and return this slice somehow back to the main program.<br>At the moment my code looks like<br><br><b><u>main program:</u></b><br>    ....<br>
    typedef itk::Image&lt;PixelType, 2&gt; OutputImageType; <br>    OutputImageType::Pointer outimage;<br>    void * pimg = &amp;outimage;<br>    extractSlice(pimg, dim);<b><span style="color:rgb(255,0,0)"></span></b><br>
     .....<br><br><br><u><b>void extractSlice(void * pimg, int dim)</b></u><br><br>    typedef itk::Image&lt;PixelType, 2&gt; OutputImageType; <br>    typedef itk::ExtractImageFilter&lt;ImageType, OutputImageType&gt; ExtractFilterType;<br>
    ExtractFilterType::Pointer extractFilter = ExtractFilterType::New();<br><br>    ... <br><br>    OutputImageType::Pointer outimage = OutputImageType::New();<br>    <br>    try<br>    {<br>        extractFilter-&gt;Update(); <br>
        outimage = extractFilter-&gt;GetOutput();<br>        ImageType::Pointer *kimg = (ImageType::Pointer *)pimg;<br>       <b style="color:rgb(255,0,0)"> kimg = outimage.GetPointer();</b> <b> //NOT WORKING</b><br>    }<br>
    catch(itk::ExceptionObject &amp;err)<br>    {<br>       ...<br>    }<br><br>Does one of you know how to solve my problem?<br>Thanks a lot for your help!<br><br>Best regards<br>melanie<br>