Extract the 3 componenets x,y,z of gradiant filter

There are many ways to access voxel data. Simple methods, such as GetScalarComponentAsDouble are extremely slow, raw buffer access, such as GetScalarPointer only work well for known memory layout (Slicer uses only the default memory layout, so it should be fine), fast and flexible methods use multithreading and array dispatching, which are extremely complicated.

In your case, I would recommend using GetScalarPointer.

1 Like