[ITK] N4BiasCorrection output size

Lowekamp, Bradley (NIH/NLM/LHC) [C] blowekamp at mail.nih.gov
Tue Jan 24 09:32:47 EST 2017


Hello,

I am sorry to hear that you find SimpleITK “poorly managed”. It is not clear to me what problems you are having to cause that view. SimpleITK is an open source project, if you find some aspect of documentation lacking you are welcomed to help improve it. Or give specific suggestions, the can be address when resources are available. The current documentation with SimpleITK is not independent of ITK. It requires some knowledge of how ITK works. To that end the “ITK Software Guide” [1] is a useful resource.

The particular problem with the `WriteImage` procedure and keyword argument is due to a bug (or lack of feature) in SWIG. SWIG is used to provide language bindings for all of SimpleITK supported languages. SWIG does not support keyword arguments with overloaded functions. In this case there are two `WriteImage` methods[2][3], so keywords arguments do not work in Python.

The work around is to not use keyword arguments i.e. `sitk.WriteImage(img, “out.mha”, True)` or to use the object oriented interface and set the parameter.

Now regarding the question:
Can u tell me if there will be information loss on conversion to Int16?

By definition of conversion from float to int16 you are loosing information. The two numeric representations are different sets with different ranges.

Is the information loss significant? is it just noise? what magnitude is it? does it have an impact on your processing? These are all questions for you to experiment with and determine.

The Cast filter does a raw C++ cast between types [4], which does have some caveats. If the range of the input is problematic then the ClampImageFilter [5] could be used.

Hope that helps,
Brad

[1] https://itk.org/ITK/help/documentation.html
[2] https://itk.org/SimpleITKDoxygen/html/namespaceitk_1_1simple.html#a26db5ae04c6df98d7b072f03fd435fdd
[3] https://itk.org/SimpleITKDoxygen/html/namespaceitk_1_1simple.html#ae67de579bc4b36c11f322af08061f697
[4] http://www.cplusplus.com/doc/tutorial/typecasting/
[5] https://itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1ClampImageFilter.html

On Jan 24, 2017, at 1:28 AM, Vishwanathan Shreyas <shreyas122011 at gmail.com<mailto:shreyas122011 at gmail.com>> wrote:

Also, using useCompression=True as parameter in SimpleITK.WriteImage() gives:

TypeError: WriteImage() got an unexpected keyword argument 'useCompression'


Though I appreciate the work on SimpleITK, I can't help but say that SimpleITK is very poorly managed.

On Tue, Jan 24, 2017 at 11:56 AM, Vishwanathan Shreyas <shreyas122011 at gmail.com<mailto:shreyas122011 at gmail.com>> wrote:
Hi Džena,

Thanks for the advice! Can u tell me if there will be information loss on conversion to Int16?

Regards,
Shreyas

On Mon, Jan 23, 2017 at 11:20 PM, Dženan Zukić <dzenanz at gmail.com<mailto:dzenanz at gmail.com>> wrote:
Hi Shreyas,

more likely reason is that you did not turn on compression in the ImageFileWriter. And casting the output back to int16 would decrease the size further.

Regards,
Dženan

On Mon, Jan 23, 2017 at 11:50 AM, Vishwanathan Shreyas <shreyas122011 at gmail.com<mailto:shreyas122011 at gmail.com>> wrote:
Hi,

I'm using SimpleITK on python. I wanted to perforn N4 bias correction on the MICCAI BRATS database. For that, first I cast the images to Float32, which were initially Int16 and then passed it to the filter.

When I saved the output on disk, I found a huge gap between the input and output sizes.

INPUT: ~2MB
OUPUT: ~33MB !!!

I know that float takes more space, but can we cast the output to Int16 again without loss of information(as I don't believe float pixel values mean anything)?

Thanks,
Shreyas


_______________________________________________
Community mailing list
Community at itk.org<mailto:Community at itk.org>
http://public.kitware.com/mailman/listinfo/community





_______________________________________________
Community mailing list
Community at itk.org<mailto:Community at itk.org>
http://public.kitware.com/mailman/listinfo/community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20170124/bcc37b84/attachment.html>


More information about the Community mailing list