And sounds interesting :-) - Since you're working on lesion data, you probably want to use either the SameVariance mode, or EM with a prior, presuming you've got a good whilte/grey matter segmentation. You should probably stay clear of the EM mode (There's a chance it'll fit something that you don't want it to).

If you're working on 3T data, work with a smoothing distance of ~50 (controls the number of basis functions in the model). A regularization value of around 1e-6 is probably good. This is presuming you use splines - with cosines, things change. Ideally, you need to do a small study before you 'go live', where you tune your regularization and measure performance by means of the effect in the coefficient joint of variation between voxels you are certain to be white and grey matter. This way, you optimize the separation between the two, and thereby obtain the best correction.



A few notes:
This is not only N3; rather, it's the real EM way of doing the correction (as per Leemput1999 and Larsen2014) + the heuristic modifications that N3 employs. Note that the original N3 suffers from a few problems, in particular that the linear system of equations that is solved, with respect to some number of bsplines to obtain the bias field estimate, has numerical problems. In this sense, this code is 'correct', and the original is 'wrong'. Moreover, There can be slight numerical differences (which accumulates over iterations). I have in the past verified this code to produce results equal to N3 on the fourth decimal, however.

I suggest you play with the N3 code, but if you want to do good correction, here is the prioritized order of how you should correct:
EM with a prior - by far the best correction
EM - all update equations are correct, but note taht there's a chance that Gaussians may collapse if you use too many. Haven't seen this happen a lot though. Make sure to inspect your results!
EM with same variance - 'N3 like', and correct in all parts of the EM optimization. Robust, but not that fast 
N3 mode (using a regularized least squares to fit the gaussians to the histogram - slowest)



