1. why start with minus one when writing the for loop of our kernel step?

    • This is how the center voxel is found, it will be the only one in the grid with a value < 0 thereby triggering the if (d < 0) conditional.

  2. If I’m understanding correctly, expanding the grid from 3×3 to 5×5, 7×7, etc is done by increasing the conditional value on the nested if statements, i.e. xo <= 1 becoming xo <= 2 would create a 5×5 grid. Is that correct?


    • That is correct. Remember that you will need to adjust the initial value for your xo, yo, and zo if you wish to make use of a different kernel grid.

  3. I think the initial values of xo, yo, and zo should be properly declared at the top of the code. Thus you will not have to go over one after the other every time you want to change the values. At the same time, that variables should take care of the value in the if statement. Even more, you can promote a set of a few variables and make all the computation internally in the nested for loops.
    I just have a question. Is there any reason for the -14, or is it just a random value after tweaking?

Leave a Reply