<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>I think an example is the best way to solve my problem.<br><br>Let us take following 3D Data with name 3DImage as itk.simple.image<div>Xdata={{-4,-2,0,2,4},<span style="font-size: 12pt;">{-4,-2,0,2,4},</span><span style="font-size: 12pt;">{-4,-2,0,2,4},</span><span style="font-size: 12pt;">{-4,-2,0,2,4},</span><span style="font-size: 12pt;">{-4,-2,0,2,4}</span><span style="font-size: 12pt;">}</span></div><div><span style="font-size: 12pt;">Ydata={{2,2,2,2,2},{1,1,1,1,1},{0,0,0,0,0},</span><span style="font-size: 12pt;">{-1,-1,-1,-1,-1},{-2,-2,-2,-2,-2}}</span></div><div><span style="font-size: 12pt;">Zdata={{0,0,0,0,0},</span><span style="font-size: 12pt;">{0,0,0,0,0},</span><span style="font-size: 12pt;">{0,0,0,0,0},</span><span style="font-size: 12pt;">{0,0,0,0,0},</span><span style="font-size: 12pt;">{0,0,0,0,0}}</span></div><div><span style="font-size: 12pt;"><br></span></div><div><span style="font-size: 12pt;">and LabelImage as </span><span style="font-size: 12pt;">itk.simple.image</span></div><div><span style="font-size: 12pt;">LabelImage={{</span><span style="font-size: 12pt;">{0,0,0,0,0},</span><span style="font-size: 12pt;">{0,1,1,1,0},</span><span style="font-size: 12pt;">{0,1,1,1,0},</span><span style="font-size: 12pt;">{0,1,1,1,0},</span><span style="font-size: 12pt;">{0,0,0,0,0}}</span></div><div><span style="font-size: 12pt;"><br></span></div><div><span style="font-size: 12pt;">The surface area with label 1 should be 12.</span></div><div>Which steps (<span style="font-size: 12pt;">C# or C++) </span><span style="font-size: 12pt;">do I need to take to solve this? </span></div><div><br></div><div>Thank you guys</div><div><div><br></div><div><div><hr id="stopSpelling">From: dzenanz@gmail.com<br>Date: Wed, 10 Aug 2016 09:27:05 -0400<br>Subject: Re: [ITK] Determine surface area of certain region in image<br>To: matthias.b@hotmail.com<br>CC: community@itk.org; dan.muel@gmail.com; blowekamp@mail.nih.gov<br><br><div dir="ltr"><div class="ecxgmail_default" style="font-family:verdana,sans-serif;font-size:small;">Sorry, I have confused <a href="https://itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1LabelShapeStatisticsImageFilter.html" target="_blank">LabelShapeStatistics</a> with <a href="https://itk.org/Doxygen/html/classitk_1_1LabelStatisticsImageFilter.html" target="_blank">LabelStatistics</a> filter.</div><div class="ecxgmail_default" style="font-family:verdana,sans-serif;font-size:small;"><br></div><div class="ecxgmail_default" style="font-family:verdana,sans-serif;font-size:small;">With label shape statistics, there is no intensity image, only the label image which you are already using as input.</div><div class="ecxgmail_default" style="font-family:verdana,sans-serif;font-size:small;"><br></div><div class="ecxgmail_default" style="font-family:verdana,sans-serif;font-size:small;">You generally don't mix (add) label and intensity images, you just keep them separate and know which two are a pair. For label statistics, you simply set two inputs like in this <a href="https://itk.org/Wiki/ITK/Examples/ImageProcessing/LabelStatisticsImageFilter" target="_blank">example</a>.</div><div class="ecxgmail_default" style="font-family:verdana,sans-serif;font-size:small;"><br></div><div class="ecxgmail_default" style="font-family:verdana,sans-serif;font-size:small;">Regards</div></div><div class="ecxgmail_extra"><br><div class="ecxgmail_quote">On Wed, Aug 10, 2016 at 9:19 AM, Matthias B <span dir="ltr"><<a href="mailto:matthias.b@hotmail.com" target="_blank">matthias.b@hotmail.com</a>></span> wrote:<br><blockquote class="ecxgmail_quote" style="border-left:1px #ccc solid;padding-left:1ex;">
<div><div dir="ltr">I understand, but how do I add the label on the 3D image programmatically?<div>preferable in C#, but C++ is also ok.</div><div><br></div><div><span>Thank you for your help<br></span><div><hr>From: <a href="mailto:dzenanz@gmail.com" target="_blank">dzenanz@gmail.com</a><br>Date: Wed, 10 Aug 2016 09:14:35 -0400<span><br>Subject: Re: [ITK] Determine surface area of certain region in image<br>To: <a href="mailto:matthias.b@hotmail.com" target="_blank">matthias.b@hotmail.com</a><br></span>CC: <a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>; <a href="mailto:dan.muel@gmail.com" target="_blank">dan.muel@gmail.com</a>; <a href="mailto:community@itk.org" target="_blank">community@itk.org</a><div><div class="h5"><br><br><div dir="ltr"><div style="font-family:verdana,sans-serif;font-size:small;">The 3D image where the label will be applied is need for statistics such as mean, min and max values. If you don't care about those, you can supply the same image as both label and original (intensity) image. Or you can supply an empty (all black) image there.</div><div style="font-family:verdana,sans-serif;font-size:small;"><br></div><div style="font-family:verdana,sans-serif;font-size:small;">HTH,</div><div style="font-family:verdana,sans-serif;font-size:small;">Dženan</div></div><div><br><div>On Wed, Aug 10, 2016 at 8:47 AM, Matthias B <span dir="ltr"><<a href="mailto:matthias.b@hotmail.com" target="_blank">matthias.b@hotmail.com</a>></span> wrote:<br><blockquote style="border-left:1px #ccc solid;padding-left:1ex;">
<div><div dir="ltr">Thank you for answering <span style="font-family:verdana,sans-serif;font-size:10pt;">Dženan</span>,<div><br></div><div>ok<span style="font-size:12pt;">, the perimeter attribute is what I need.</span></div><div><span style="font-size:12pt;"><br></span></div><div>Problem is that I don't see a way where I can</div><div>1. Choose a label image to define the region</div><div>2. Choose the 3D Image where the label will be aplied</div><div><br></div><div>At this moment it looks for me that the label image already contains the 3D data, which confuses me.<br><div><br><div><hr>From: <a href="mailto:dzenanz@gmail.com" target="_blank">dzenanz@gmail.com</a><br>Date: Wed, 10 Aug 2016 08:32:53 -0400<span><br>Subject: Re: [ITK] Determine surface area of certain region in image<br></span>To: <a href="mailto:matthias.b@hotmail.com" target="_blank">matthias.b@hotmail.com</a><br>CC: <a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>; <a href="mailto:community@itk.org" target="_blank">community@itk.org</a><div><div><br><br><div dir="ltr"><div style="font-family:verdana,sans-serif;font-size:small;">Hi Matthias,</div><div style="font-family:verdana,sans-serif;font-size:small;"><br></div><div style="font-family:verdana,sans-serif;font-size:small;">perimeter should be surface area in 3D (which you can divide by 2 to eliminate back side if you have a very flat object). In 2D image, it is the circumference. In 2D image, you can get object's surface area by counting how many pixels it has and then multiplying that by the size of each pixel (spacing[0]*spacing[1]).</div><div style="font-family:verdana,sans-serif;font-size:small;"><br></div><div style="font-family:verdana,sans-serif;font-size:small;">Regards,</div><div style="font-family:verdana,sans-serif;font-size:small;">Dženan</div></div><div><br><div>On Wed, Aug 10, 2016 at 2:40 AM, Matthias B <span dir="ltr"><<a href="mailto:matthias.b@hotmail.com" target="_blank">matthias.b@hotmail.com</a>></span> wrote:<br><blockquote style="border-left:1px #ccc solid;padding-left:1ex;">
<div><div dir="ltr">Thank you for answering!<div><br></div><div>At this moment I get the perimeter in pixel units (not the surface area of my X,Y-data) of my labeled image.</div><div>I have also really no idea how to use my 3D data with a labeled image. <span style="font-size:12pt;">I see no way how to add 3D data to a LabelMap for example.</span></div><div><br></div><div>This is what I have at the moment.</div><div><div>Dim labelShapeStatistics = New simple.LabelShapeStatisticsIma<wbr>geFilter()</div><div>labelShapeStatistics.Execute(l<wbr>abelImage)</div><div>Dim perimeterValue= labelShapeStatistics.GetPerime<wbr>ter(1)</div><div><br></div><div>Thanks for any help, Matthias</div><div><br></div><div><div><br></div><br></div><div><div><hr>From: <a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a><br>To: <a href="mailto:matthias.b@hotmail.com" target="_blank">matthias.b@hotmail.com</a><br>CC: <a href="mailto:community@itk.org" target="_blank">community@itk.org</a><br>Subject: Re: [ITK] Determine surface area of certain region in image<br>Date: Tue, 9 Aug 2016 15:58:56 +0000</div><div><div><br><br>
Hello,
<div><br>
</div>
<div>You should look into the label map framework [1]. In particular the LabelImageToShapeLabelMapFilte<wbr>r[2] and the Perimeter attribute [3] [4].</div>
<div><br>
</div>
<div>HTH,</div>
<div>Brad</div>
<div><br>
</div>
<div>[1] <a href="http://hdl.handle.net/1926/584" target="_blank">http://hdl.handle.net/1926<wbr>/584</a></div>
<div>[2] <a href="https://itk.org/Doxygen/html/classitk_1_1LabelImageToShapeLabelMapFilter.html" target="_blank">https://itk.org/Doxygen/ht<wbr>ml/classitk_1_1LabelImageToSha<wbr>peLabelMapFilter.html</a></div>
<div>[3] <a href="https://itk.org/Doxygen/html/classitk_1_1ShapeLabelObject.html#aff1209e925293c15775520ef89e97afb" target="_blank">https://itk.org/Doxygen/ht<wbr>ml/classitk_1_1ShapeLabelObjec<wbr>t.html#aff1209e925293c15775520<wbr>ef89e97afb</a></div>
<div>[4] <a href="http://hdl.handle.net/10380/3342" target="_blank">http://hdl.handle.net/1038<wbr>0/3342</a></div>
<div><br>
<div>
<blockquote>
<div>On Aug 9, 2016, at 11:50 AM, Matthias B <<a href="mailto:matthias.b@hotmail.com" target="_blank">matthias.b@hotmail.com</a>> wrote:</div>
<br>
<div>
<div dir="ltr" style="font-family:Calibri;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;">
Hello ITK-community,
<div><br>
</div>
<div>At the moment I'm working with 3D Images with following structure: 100x80x3. Every pixel contains a X,Y,Z value.<br>
I want to calculate the surface area of a certain region that I have defined with a boolean 2D-Image (100x80).</div>
<div>The surface area should only be calculated with the X,Y-data.</div>
<div><br>
</div>
<div>In Matlab I have experience with this by using the function bwboundaries on the boolean image. This function determines the indices of the the boundaries in clockwise direction. Next I take the corresponding X,Y values of the indices so I can
calculate the surface area with the function polyarea. <br>
</div>
<div><br>
</div>
<div>Is this possbile with the ITK-library?</div>
<div><br>
</div>
<div>Thank you for your help guys.</div>
<div><br>
<table style="border-top-width:1px;border-top-style:solid;border-top-color:rgb(211,212,222);">
<tbody>
<tr>
<td style="width:55px;padding-top:18px;"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail" target="_blank"><img src="https://ipmcdn.avast.com/images/2016/icons/icon-envelope-tick-round-orange_184x116-v1.png" width="46" height="29" style="width:46px;min-height:29px;"></a></td>
<td style="width:470px;padding-top:17px;color:rgb(65,66,78);font-size:13px;font-family:Arial,Helvetica,sans-serif;line-height:18px;">
Virusvrij.<span> </span><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail" style="color:rgb(68,83,234);" target="_blank">www.avast.com</a></td>
</tr>
</tbody>
</table>
<a target="_blank"></a></div>
</div>
<span style="font-family:Calibri;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline !important;">______________________________<wbr>_________________</span><br style="font-family:Calibri;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;">
<span style="font-family:Calibri;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline !important;">Community
mailing list</span><br style="font-family:Calibri;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;">
<a href="mailto:Community@itk.org" style="font-family:Calibri;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" target="_blank">Community@itk.org</a><br style="font-family:Calibri;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;">
<a href="http://public.kitware.com/mailman/listinfo/community" style="font-family:Calibri;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/community</a></div>
</blockquote>
</div>
<br>
</div></div></div></div></div> </div></div>
<br>______________________________<wbr>_________________<br>
Community mailing list<br>
<a href="mailto:Community@itk.org" target="_blank">Community@itk.org</a><br>
<a href="http://public.kitware.com/mailman/listinfo/community" rel="noreferrer" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/community</a><br>
<br></blockquote></div><br></div></div></div></div></div></div><div><br> <table style="border-top:1px solid #d3d4de;">
<tbody><tr>
<td style="width:55px;padding-top:18px;"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail" target="_blank"><img src="https://ipmcdn.avast.com/images/2016/icons/icon-envelope-tick-round-orange_184x116-v1.png" width="46" height="29" style="width:46px;min-height:29px;"></a></td>
<td style="width:470px;padding-top:17px;color:#41424e;font-size:13px;font-family:Arial,Helvetica,sans-serif;line-height:18px;">Virusvrij. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail" style="color:#4453ea;" target="_blank">www.avast.com</a> </td>
</tr>
</tbody></table>
<a href="#m_1512104202195024141_m_4192781686007042514_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"></a></div> </div></div>
</blockquote></div><br></div></div></div></div></div> </div></div>
</blockquote></div><br></div></div></div></div> </div></body>
</html>