<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Wenwu,<div><br></div><div>First, I would donwload and updated version of N4.cxx</div><div><br></div><div><a href="http://advants.svn.sourceforge.net/viewvc/advants/Examples/N4BiasFieldCorrection.cxx?view=log">http://advants.svn.sourceforge.net/viewvc/advants/Examples/N4BiasFieldCorrection.cxx?view=log</a></div><div><br></div><div>as I don't use N4.cxx anymore and have updated.</div><div><br></div><div>Second, your command line convergence parameter&nbsp;</div><div>is incorrect. &nbsp;I'm guessing you meant</div><div><br></div><div>-c [20x20x20,0.001]</div><div><br></div><div>Doing that works for me.</div><div><br></div><div>Nick</div><div><br></div><div>Ps. I'm cc'ing the insight users list. &nbsp;I'd recommend keeping this&nbsp;</div><div>conversation on the list---I know it's useful for me to search the</div><div>archives of previous conversations to find solutions to my</div><div>problems.</div><div><br></div><div><br><div><div>On Jan 9, 2012, at 10:18 AM, Wenwu wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Sorry, I forgot to show the commander to run this test. The code is as following:<br>N4.exe -d 2 -i e:/image_22 -o e:/image_22BC.mhd -s 2 -c [20*20*20m 0.001] -b [200,3] -t [0.15 0.001, 200] <br><br><br><div class="gmail_quote">

On Mon, Jan 9, 2012 at 6:13 PM, Wenwu <span dir="ltr">&lt;<a href="mailto:cool.wenwu@gmail.com">cool.wenwu@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi Nicholas,<br><br>Thank you very much for your kind help! Now there is another problem needed your help!<br><br>I run N4 with Dicom image(Reading code I added) to test, because the N4 seems can not output Dicom format, so I choose to output .mhd file. However the outcome is very bad. Could you please give&nbsp; me some suggestion? <br>


<br>In addition, after adding code of&nbsp; writing Dicom format, there is an debug error. The code can run in my other program.<br>The code was added as this:<br><br>if (outputOption-&gt;GetNumberOfParameters() ==0 )<br>{<br>


...<br>typedef itk::GDCMImageIO ImageIOType;<br>ImageIOType::Pointer gdcImageTypeIO = ImageIOType::New();<br>...<br>Writer-&gt;SetFileName(gdcImageTypeIO);<br>}<br>// of course, other two cases, I also add them<br><br>Could you please give some prompt about it?<br>


<br>The original MRI image is attached.<br>The result of the N4 processing with .mhd Format is as following:<br><br><span>&lt;image22_BC.png&gt;</span><div class="HOEnZb"><div class="h5">

<br><br><br><br><br><br>&nbsp;<br>
<br><div class="gmail_quote">On Mon, Jan 9, 2012 at 5:17 PM, Nicholas Tustison <span dir="ltr">&lt;<a href="mailto:ntustison@gmail.com" target="_blank">ntustison@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div style="word-wrap:break-word">Hi Wenwu,<div><br></div><div><div><div><blockquote type="cite">There are some problems when I learn the N4ITK. Firstly, in the paper-"N4ITK:Nick's N3 ITK Implementation For MRI Bias Field Correction" , I found there are 9 parameters (m_MaskMabel, m_numberOfHistogamBins, m_WeinerFilterNoise, m_BiasFieldFullWitdthAtHalfMaximum... ,)need to set, it can also be found in the N4ITK package.&nbsp; However, in the lastest ITK4.0, in the project-ITKBiasCorrectionTestDriver, I open the CMakeLists.txt, and some code is as followiing:<br>




&nbsp;<br>itk_add_test(NAME itkN4BiasFieldCorrectionImageFilterTest1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMMAND ITKBiasCorrectionTestDriver<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --compare DATA{Baseline/N4ControlPoints_3D.nii.gz}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ${ITK_TEST_OUTPUT_DIR}/N4ControlPoints_3D.nii.gz<br>




&nbsp;&nbsp;&nbsp; itkN4BiasFieldCorrectionImageFilterTest<br>&nbsp;&nbsp;&nbsp; 2<br>&nbsp;&nbsp;&nbsp; DATA{${ITK_DATA_ROOT}/Input/HeadMRVolumeCompressed.mha}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # input<br>&nbsp;&nbsp;&nbsp; ${ITK_TEST_OUTPUT_DIR}//N4ControlPoints_3D.nii.gz&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # <b>control point lattice&nbsp; .</b> , I also can not understand the mean of this parameter<br>




<br>&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; # shrink factor<br>&nbsp;&nbsp;&nbsp; 10x10x10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # number of iterations<br>&nbsp;&nbsp;&nbsp; none&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # mask<br>




&nbsp;&nbsp;&nbsp; 150&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # spline distance<br>&nbsp;&nbsp;&nbsp; )<br><br></blockquote><div><br></div></div><div>The control point lattice is the output defining&nbsp;the bias field. &nbsp;</div><div>


You need to remember that this is a test, not a user-level</div><div>application which is what N4.cxx encapsulates.</div><div><br></div><div>Nick</div><div><br></div></div></div></div></blockquote></div><br><br clear="all">


<br></div></div><div class="HOEnZb"><div class="h5">-- <br><div>Wenwu Zhu</div>
<div>IRCAD<br>University of Strasbourg, France<br>Email address: <a href="mailto:cool.wenwu@gmail.com" target="_blank">cool.wenwu@gmail.com</a></div><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div>Wenwu Zhu</div>
<div>IRCAD<br>University of Strasbourg, France<br>Email address: <a href="mailto:cool.wenwu@gmail.com" target="_blank">cool.wenwu@gmail.com</a></div><br>
</blockquote></div><br></div></body></html>