[Insight-users] Can't use 16-bit?

Bradley Lowekamp blowekamp at mail.nih.gov
Thu Apr 4 20:56:48 EDT 2013


Hello,

We have a python example for this filter it should be a good starting point:

http://www.itk.org/SimpleITKDoxygen/html/N4BiasFieldCorrection_8py-example.html

To change the image type you simply need to use the CastImageFilter.

Also if you want to look at what image types a filter works with look at the PixelIDTypeList defined for that filter in the Doxygen:

http://www.itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1N4BiasFieldCorrectionImageFilter.html#a56b78dd41836a5fce343fef10a65d848

I have had quite a few discussions recently, about how to improve this error message. What would you have liked to see?

Brad

On Apr 4, 2013, at 6:17 PM, "Becksfort, Jared" <Jared.Becksfort at STJUDE.ORG> wrote:

> Hello,
>  
> This is a question regarding the Java version of SimpleITK.  I downloaded some .mha files from the BRATS segmentation challenge and can’t seem to get the bias field correction using N4BiasFieldCorrectionImageFilter to work. 
>  
> I get this error when running a downloaded image and when running a .tif file too:
>  
> Exception in thread "main" java.lang.RuntimeException: Exception thrown in SimpleITK N4BiasFieldCorrectionImageFilter_execute: c:\d\vs9-release\simpleitk\code\common\include\sitkDualMemberFunctionFactory.hxx:201:
> sitk::ERROR: Pixel type: 16-bit signed integer is not supported in 3D byclass itk::simple::N4BiasFieldCorrectionImageFilter
>        at org.itk.simple.SimpleITKJNI.N4BiasFieldCorrectionImageFilter_execute__SWIG_0(Native Method)
>        at org.itk.simple.N4BiasFieldCorrectionImageFilter.execute(N4BiasFieldCorrectionImageFilter.java:124)
>        at utility.BiasCorrectionTest.main(BiasCorrectionTest.java:19)
>  
> Does anyone know if I am doing something wrong or if there is a problem with the class in Java?  I am fairly sure that it can handle 16-bit images normally because a number of people have used it in their publications that use BRATS data.  I don’t know that they were using the Java version though.  I haven’t tried converting it to another data type yet because…well I don’t know how.  I will look into that, but I figure it is something else that I am doing wrong.
>  
> The code is below.  Images can be downloaded from here in case someone wants to go to the trouble of actually doing so.  Hopefully it is just me doing something stupid and quick for someone to point out.
>  
> http://challenge.kitware.com/midas/folder/102
>  
> Thanks!
> Jared
>  
>  
> package utility;
>  
> import org.itk.simple.Image;
> import org.itk.simple.SimpleITK;
> import org.itk.simple.N4BiasFieldCorrectionImageFilter;
>  
> public class BiasCorrectionTest {
>  
>     /**
>      * @param args
>      */
>     public static void main(String[] args) {
>  
>         String inFilename = "BRATS_HG0004_T1.mha";
>         String outFilename = "biasTestOut_4_T1.mha";
>         Image image = SimpleITK.readImage(inFilename);
>         Image corrected = new Image(image);
>         N4BiasFieldCorrectionImageFilter correcter = new N4BiasFieldCorrectionImageFilter();
>         correcter.execute(image, corrected);  // The error happens here
>         SimpleITK.writeImage(corrected, outFilename);
>     }
> }
> 
> Email Disclaimer: www.stjude.org/emaildisclaimer
> Consultation Disclaimer: www.stjude.org/consultationdisclaimer
> _____________________________________
> 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://www.itk.org/mailman/listinfo/insight-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130404/3375c105/attachment.htm>


More information about the Insight-users mailing list