[ITK] [ITK-users] Inside value and outside value for itk::OtsuThresholdImageFilter
沈庄明
zhuangming.shen at sphic.org.cn
Thu Apr 7 21:42:35 EDT 2016
Hi all,
It seems to be a bug for itk.OtsuThresholdImageFilter. When I use SetInsideValue(0) and SetOutsideValue(255), I got the result displayed in Fig. 2, where inside voxel value is 255 and outside voxel value is 0. Inversely, when I use SetInsideValue(255) and SetOutsideValue(0), I got the result displayed in Fig. 3, where the inside voxel value is 0 and the outside voxel value is 255. It seems totally inversely. Is that right? Have someone else met this situation before? Thanks in advance.
Regards,
Zhuangming Shen
=============== My code =================
import itk
reader = itk.ImageFileReader[itk.Image.SS3].New()
reader.SetFileName("ct.nrrd")
reader.Update()
otsu_filter = itk.OtsuThresholdImageFilter[itk.Image.SS3, itk.Image.UC3].New()
otsu_filter.SetInput(reader.GetOutput())
otsu_filter.SetInsideValue(0)
otsu_filter.SetOutsideValue(255)
otsu_filter.Update()
writer = itk.ImageFileWriter[itk.Image.UC3].New()
writer.SetInput(otsu_filter.GetOutput())
writer.SetFileName("otsu.nrrd")
writer.Update()
Fig. 1 ct.nrrd
[cid:15b5cb2e-24ee-4092-99ff-d5bfd99c9d58]
Fig. 2 otsu segmentation result for SetInsideValue(0) and SetOutsideValue(255)
[cid:1c274aac-d532-4e55-8d5e-0a5847dea5af]
Fig. 3 otsu segmentation result for SetInsideValue(255) and SetOutsideValue(0)
[cid:917c3ca4-8e81-4d99-af7c-fc6af0639a43]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20160408/2b774b6f/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 152425 bytes
Desc: pastedImage.png
URL: <http://public.kitware.com/pipermail/community/attachments/20160408/2b774b6f/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 21677 bytes
Desc: pastedImage.png
URL: <http://public.kitware.com/pipermail/community/attachments/20160408/2b774b6f/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 20783 bytes
Desc: pastedImage.png
URL: <http://public.kitware.com/pipermail/community/attachments/20160408/2b774b6f/attachment-0005.png>
-------------- next part --------------
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users
More information about the Community
mailing list