TFCE manual calculation

So if i set E=1 and H=2 (for 2D images), for each cluster in the t-stat image, the TFCE statistic will be (t-stat of the cluster) * 2 * (number of voxels in the cluster), am i right?

You should not reimplement this. Please take a look at (or rather, reuse)