<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
</head>
<body dir="auto">
<div>I am sorry but i did not find the <span style="background-color: rgba(255, 255, 255, 0);">
SetUsePixelSpacingOff. Could you explain to me the way of using it. Also, what actually does it mean to turn off the spacing between slices and slice pixel and how is it related to contour generation .</span></div>
<div id="AppleMailSignature">Kind regards,<br>
<br>
Sent from my iPhone</div>
<div><br>
On 7 Feb 2017, at 13:46, Dženan Zukić <<a href="mailto:dzenanz@gmail.com">dzenanz@gmail.com</a>> wrote:<br>
<br>
</div>
<blockquote type="cite">
<div>
<div dir="auto">Try SetUsePixelSpacingOff.</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Feb 7, 2017 06:30, "Abdelkhalek Bakkari" <<a href="mailto:bakkari.abdelkhalek@hotmail.fr">bakkari.abdelkhalek@hotmail.fr</a>> wrote:<br type="attribution">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div id="m_2094535964551032782divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:'Times New Roman',Times,serif" dir="ltr">
<p>Dear ITK users,</p>
<p><br>
</p>
<p>After using the BinaryFillHoleFilter for a 3D Dicom image (see attached), I adopted the <span>BinaryContourImageFilter in order to obtain the contour of the image. However, the thikness of the contour is very big. My goal is to obtain 1 pixel of thickness.</span></p>
<p><span><br>
</span></p>
<p><span>The fragment of my code is :</span></p>
<p><span><br>
</span></p>
<p><span>------------------------------<wbr>------------------------</span></p>
<p><span></span></p>
<div>#include "itkImage.h"</div>
<div>#include "itkImageFileReader.h"</div>
<div>#include "itkImageFileWriter.h"</div>
<div>#include "<wbr>itkRescaleIntensityImageFilter<wbr>.h"</div>
<div>#include "itkCastImageFilter.h"</div>
<div>#include "<wbr>itkCannyEdgeDetectionImageFilt<wbr>er.h"</div>
<div>#include <itkBinaryContourImageFilter.<wbr>h></div>
<div>#include <vtkImageData.h></div>
<div>#include <vtkExtractVOI.h></div>
<div>#include <itkLabelToRGBImageFilter.h></div>
<div>#include <itkImageToVTKImageFilter.h></div>
<div>#include <itkVTKImageToImageFilter.h></div>
<div>#include <vtkSmartPointer.h></div>
<div><br>
</div>
<div>int main(int argc, char **argv)</div>
<div>{</div>
<br>
<p></p>
<p><span></span></p>
<div> const unsigned int Dimension = 3;</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>typedef unsigned char<span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap">
</span>InputPixelType;</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>typedef unsigned char OutputPixelType;</div>
<div><br>
</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>typedef itk::Image<InputPixelType, Dimension> InputImageType;</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>typedef itk::Image<OutputPixelType, Dimension> OutputImageType;</div>
<div><br>
</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>typedef itk::ImageFileReader< InputImageType > ReaderType;</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>ReaderType::Pointer reader = ReaderType::New();</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>reader->SetFileName("<wbr>BinaryFillHoleImage.mha");</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>reader->Update();</div>
<div><br>
</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>//Slice by Slice Binary Contour</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>// Binary Contour Filter</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>typedef itk::BinaryContourImageFilter <InputImageType, InputImageType > binaryContourImageFilterType;</div>
<div><br>
</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>binaryContourImageFilterType::<wbr>Pointer binaryContourFilter = binaryContourImageFilterType::<wbr>New ();</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>binaryContourFilter->SetInput(<wbr>reader->GetOutput());</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>binaryContourFilter-><wbr>SetFullyConnected(1); // true makes thicker contours</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>binaryContourFilter-><wbr>SetBackgroundValue(0);</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>binaryContourFilter-><wbr>SetForegroundValue(255); // the value of your binary mask</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>binaryContourFilter->Update();</div>
<div><br>
</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>typedef itk::<wbr>RescaleIntensityImageFilter< InputImageType, InputImageType > RescaleType;</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>RescaleType::Pointer rescaler = RescaleType::New();</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>rescaler->SetInput( binaryContourFilter-><wbr>GetOutput() );</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>rescaler->SetOutputMinimum( 0 );</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>rescaler->SetOutputMaximum( 255 );</div>
<div><br>
</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>typedef itk::CastImageFilter< InputImageType, OutputImageType > FilterType;</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>FilterType::Pointer filter = FilterType::New();</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>filter->SetInput( rescaler->GetOutput() );</div>
<div><br>
</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>// Save the contour</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>{</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>typedef itk::ImageFileWriter<<wbr>OutputImageType> WriterType;</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>WriterType::Pointer writer = WriterType::New();</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>writer->SetFileName("<wbr>Cannybinarycontour.mha");</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>writer->SetInput(filter-><wbr>GetOutput());</div>
<div><br>
</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>try{</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>writer->Update();</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>}</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>catch(itk::ExceptionObject &e)</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>{</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>std::cerr << e << std::endl;</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>}</div>
<div><span class="m_2094535964551032782Apple-tab-span" style="white-space:pre-wrap"></span>}</div>
<div><br>
</div>
<div> return EXIT_SUCCESS;</div>
<div>}</div>
<br>
<p></p>
<p></p>
<p style="font-family:"Times New Roman",Times,serif,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:16px">
------------------------------<wbr>------------------------</p>
<div><br>
</div>
<p style="font-family:"Times New Roman",Times,serif,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:16px">
</p>
Thank you in advance.
<p></p>
<p><br>
</p>
<p>Best regards,</p>
<p><br>
</p>
<div id="m_2094535964551032782Signature"><font size="3" face="Garamond">Abdelkhalek Bakkari</font>
<div><span style="line-height:14px"><font size="3" face="Garamond">Ph.D candidate in Computer Science</font></span></div>
<div><span style="line-height:20.82666778564453px;background-color:rgb(255,255,255)"><font face="Garamond" size="3">Institute of Applied Computer Science</font></span></div>
<div><span style="line-height:18.399999618530273px"><font face="Garamond" size="3">Lodz University of Technology, Poland</font></span></div>
<div><span style="line-height:18.399999618530273px"><font face="Garamond" size="3"><br>
</font></span></div>
<div><br>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</body>
</html>