jonclayden / RNifti

Fast R and C++ access to NIfTI images
45 stars 14 forks source link

3D coordinates to nifty image #6

Closed spono closed 6 years ago

spono commented 6 years ago

Hi, I'm a PhD candidate in forest ecology and I'm working on identification and quantification of forest fuels (branches and logs on the ground) using a 3D scanner. I'm pre-processing the data (spatial points with X,Y,Z coordinates) with R but I would like to test some analyses using BoneJ (bonej.org) for the 3D modelling. Is there a way to convert 3D coordinates (database?) or a RasterStack made of binary images to a nifty image?

Thanks in advance for any help!

Niccolò

jonclayden commented 6 years ago

Hi Niccolò. In broad terms, you can easily use RNifti to convert any standard R array to NIfTI format (with writeNifti). So if the object you're starting with has an as.array method, then it should be simple. If not but it has array structure (i.e. a multidimensional scalar field on a regular grid) then you should be able to get there programmatically. But to give you more specific guidance I would need a bit more information from you, or better still a reproducible example.

spono commented 6 years ago

oh, I thought a specific image should be provided, but as.array seems to solve the issue. many thanks!

jonclayden commented 6 years ago

Glad to hear it!