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

Matt McCormick matt.mccormick at kitware.com
Thu Apr 4 18:59:32 EDT 2013


Hi Jared,

Did you try casting the image to float pixel type first?

HTH,
Matt

On Thu, 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
>


More information about the Insight-users mailing list