Menu

N4 Bias Field Correction optional paramater

Help
2016-03-14
2018-06-20
1 2 > >> (Page 1 of 2)
  • alain imaging

    alain imaging - 2016-03-14

    Hi everybody,

    I performed a study using a 32-channels coil that gave me a pretty bright spot in the occipital lobe. I thought that usual bias field correction would have take care of it, but it seems that this is not the case. So, I turned myself to the N4 bias field correction, that seemed to me much more apt to the job.
    Indeed, a call as following give better reults that, e.g., SPM bias field correction:

    N4BiasFieldCorrection -d 3 -i 7875_T1.nii -s 2 -o prova2.nii.gz

    However, this is not as good as I would like, so I decided to try to boost a little bit the results using this second call

    N4BiasFieldCorrection -d 3 -i 7875_T1.nii -s 2 -c [numberOfIterations=100x100x100x100,convergenceThreshold=0.0000000001] -o prova2.nii.gz

    The problem is that this call throws this error

    Running N4 for 3-dimensional images.

    Mask not read. Creating Otsu mask.
    Exception caught:
    itk::ExceptionObject (0x301df60)
    Location: "unknown"
    File: /mnt/build/avants/bin/ITKv4/Modules/Core/Common/src/itkProcessObject.cxx
    Line: 1186
    Description: itk::ERROR: ImageToImageFilter(0x3022720): Input Primary is required but not set.

    Now, as you can see, the input image is set and does exist, as it is exactly the same as my first call, does anyone know what I am doing wrong ?

    Alain

     
  • Nick Tustison

    Nick Tustison - 2016-03-14

    Hmmm, let's start out by fixing the call. Instead of this

    $ N4BiasFieldCorrection -d 3 -i 7875_T1.nii -s 2 -c [numberOfIterations=100x100x100x100,convergenceThreshold=0.0000000001] -o prova2.nii.gz

    it should be

    $ N4BiasFieldCorrection -d 3 -i 7875_T1.nii -s 2 -c [100x100x100x100,0.0000000001] -o prova2.nii.gz

     
    • alain imaging

      alain imaging - 2016-03-14

      Thank Nick, I feel slightly dumb for this !
      I will check my calls better!

       
      • Sara

        Sara - 2018-01-24

        Thanks Nick,

        What are the parameters numberOfIterations and convergenceThreshold? and how can I know how many iterations and what threshold should be considered?
        What does this means 100x100x100x100?
        Sorry for lots of questions

        Thanks

         

        Last edit: Sara 2018-01-24
        • Nick Tustison

          Nick Tustison - 2018-01-24

          Probably start with the default, i.e., 50x50x50x50. You might want to see what increasing the number will do---100x100x100x100but keep the convergenceThreshold at 0.

           
          • Sara

            Sara - 2018-06-13

            Hi Nick, Thanks for your amazing tool,

            I am doing N4 bias Correction on knee MRIs, and this the output that I got from 100 iterations
            N4BiasFieldCorrection -d 3 -i image.nii -s 2 -c [100x100x100x100,0.0000000001] -o [image-out.nii,image-bias.nii]

            the following image shows the original image, bias field and corrected images. And Bias correction with another Matlab toolbox (Multiplicative intrinsic component optimization (MICO) for MRI bias field estimation).

            My question is that I tried ANTs Bias field correction with 100, 50 and 30 iterations separately. However, it does not improve the intensity of tissues as MICO 's bias correction. Of course these two tools are not comparable. I would like to use ANTs, however, i am worried whthere should i change a specific parameters?

            I would really appreciate if you guide me.
            Thank a lot

             

            Last edit: Sara 2018-06-13
            • stnava

              stnava - 2018-06-13

              can you share the original image?

              brian

              On Wed, Jun 13, 2018 at 9:24 AM, Sara saraeb@users.sourceforge.net wrote:

              Hi Nick, Thanks for your amazing tool,

              I am doing N4 bias Correction on knee MRIs, and this the output that I got
              from 100 iterations
              N4BiasFieldCorrection -d 3 -i image.nii -s 2 -c
              [100x100x100x100,0.0000000001] -o [image-out.nii,image-bias.nii]

              the following image shows the original image, bias field and corrected
              images. And Bias correction with another Matlab toolbox
              https://www.mathworks.com/matlabcentral/fileexchange/59752-mri-segmentation-and-bias-field-correction
              (Multiplicative intrinsic component optimization (MICO) for MRI bias field
              estimation).

              My question is that I tried ANTs Bias field correction with 100, 50 and 30
              iterations separately. However, it does not improve the intensity of
              tissues as MICO 's bias correction. Of course these two tools are not
              comparable. I would like to use ANTs, however, i am worried whthere should
              i change a specific parameters?

              I would really appreciate if you guide me.
              Thank a lot


              N4 Bias Field Correction optional paramater
              https://sourceforge.net/p/advants/discussion/840261/thread/975b2eb8/?limit=25#2302/7e06/7c45/a157/b78f


              Sent from sourceforge.net because you indicated interest in
              https://sourceforge.net/p/advants/discussion/840261/

              To unsubscribe from further messages, please visit
              https://sourceforge.net/auth/subscriptions/

               
              • Sara

                Sara - 2018-06-13

                Thanks Brian, I have attached the original image with the name of 'original_image-001-023_org.png'.

                 
                • Nick Tustison

                  Nick Tustison - 2018-06-13

                  Hi Sara,

                  By "original images" we mean the nifti files.

                  Thanks,
                  Nick

                   
                  • Sara

                    Sara - 2018-06-14

                    Oh I am really sorry, sure. I have attached here. thank you for your help

                     

                    Last edit: Sara 2018-06-14
                    • Nick Tustison

                      Nick Tustison - 2018-06-14

                      A couple things:

                      • Is the image spacing correct? The headers specifies isotropic spacing but that makes the image look odd to me.

                      • Another important parameter to play with is the -b option. You should do something like -b [150] or -b [100].

                      • You have some outlier intensities so you might want to truncate those before applying N4. You can use ImageMath, i.e.

                      ImageMath 3 $outputImage TruncateImageIntensity $inputImage
                      
                       
                      • Sara

                        Sara - 2018-06-14

                        Dear Nick,

                        • the medical images were in .dcm format that I had load them into matlab to create the ground truth from the points. What I did was I loaded the dicom info into matlab, and then I used NIfTI_toolbox in Matlab to save as nii format by calculating the voxel size voxel_size=[dinfo.PixelSpacing',dinfo.SliceThickness]. Am I doing a mistake in ceating nii?
                        dinfo = dicominfo(dcmname);
                        voxel_size=[dinfo.PixelSpacing',dinfo.SliceThickness];
                        %%nii = make_nii(img, [voxel_size], [datatype: 2 - uint8,  4 - int16,  8 - int32,  16 - float32])
                        datatype = 2;
                        nii=make_nii(IMG,voxel_size,datatype); 
                        save_nii(nii,strcat(filename,'.nii'));
                        
                         
                        • Nick Tustison

                          Nick Tustison - 2018-06-14

                          You might be okay. The image just looked odd to me. I don't know what kind of vetting that the Nifti toolbox has gone through. We use dcm2nii. Regardless, N4 should work either way so you might want to explore the other two items I mentioned.

                           
                          • Sara

                            Sara - 2018-06-14

                            I really apprecaite your help. It is inspiring that you have developed such amazing tools and replying users question with patience and humility. Thanks a lot.

                             
                        • Sara

                          Sara - 2018-06-16

                          Dear Nick,

                          Could I ask what exactly TruncateImageIntensity is doing?

                           
                          • Nick Tustison

                            Nick Tustison - 2018-06-16

                            It reduces outlier intensity values using truncation. For example, suppose you have an image with intensity values in the range [0,100] If you specify an upper truncation limit of 95, it will take all intensity values > 95 and set them equal to 95.

                             
                            • Sara

                              Sara - 2018-06-19

                              Thank you verch for your explanation.
                              I applied-b [150] option and it did not make any difference in the illumination of different tissues. My the other question is that using DenoiseImage will be useful to use before using TruncateImageIntensity?
                              I wanna apply the following steps on MRIs in order:
                              1.N4BiasFieldCorrection
                              2.DenoiseImage
                              3.ImageMath (TruncateImageIntensity)

                              Thanks once again for your help

                               
                              • Nick Tustison

                                Nick Tustison - 2018-06-19

                                I have a hard time believing that. What are you using to visualize the images?

                                 
                                • Sara

                                  Sara - 2018-06-20

                                  Dear Nick,

                                  I used itksnap to visualize it. My apologies for asking many question. I could find out my mistake and thanks for your help :)

                                   

                                  Last edit: Sara 2018-06-21
  • Philip Cook

    Philip Cook - 2016-03-14

    If you have an accurate brain mask, passing that with -x is another way to improve results. The Otsu segmentation often does a decent job but might not be perfect.

     
    • alain imaging

      alain imaging - 2016-03-14

      I ll try that too, thanks!

       
    • alain imaging

      alain imaging - 2016-03-14

      Indeed it seems that the script is calculating a mask using the Otsu method by itself, since it print, at the very beginning "Mask not found, creating Otsu mask".
      Am I missing something ?

       
      • Philip Cook

        Philip Cook - 2016-03-14

        Right, if you don't specify a mask, N4 will create one. But you don't know how well that masking step performs. With an external mask, you can be sure that the whole brain and no extra bits are included.

         
        • alain imaging

          alain imaging - 2016-03-14

          Yep, I see. So you would still advise to create the mask on my own.
          How would you suggest to do it ?

           
  • Philip Cook

    Philip Cook - 2016-03-14

    You can try antsBrainExtraction.sh. You can also run with your existing N4 call and update the bias correction later in the pipeline, if you will define a brain mask at some point.

     
1 2 > >> (Page 1 of 2)