bbuchsbaum / neuroim

R package for working with volumetric neuroimaging data
6 stars 1 forks source link

Ignore diagonal connections #3

Open stineb opened 6 years ago

stineb commented 6 years ago

I'm using the "neuroim" package from CRAN and the function connComp3D() for identifying connected extreme events in climate impacts (the mask is here where vegetation productivity is below a certain threshold). Connected "events" identified by connComp3D() include connections of diagonally neighbouring voxels in a rectangular grid (in 2D, one gridcell is surrounded by 8 neighbours). It would be great to have an option to set this to ignore diagonal connections, i.e., considering that in 2D, each gridcell is only surrounded by 4 neighbours. This would be a straight-forward way to reduce the size of events (desirable e.g. for my application). Thanks and congratulations to this useful algorithm!

bbuchsbaum commented 6 years ago

I added the "connect" argument to connComp3D. I believe what you want is connComp3D(mask, connect="connect-6")