R SLIC image segmentation for 3D image (package OpenImageR)

99 views Asked by At

I have an 3D image (for example a MRI). I want to use the SLIC algorithm for segmentation.

Package OpenImageR provides the function superpixels. In the description (see https://search.r-project.org/CRAN/refmans/OpenImageR/html/superpixels.html) is written, one can give a 3D image as input.

But even for the simple example provided at the link above, it will not work...

library(OpenImageR)

#-------------------
# 3-dimensional data
#-------------------

path = system.file("tmp_images", "slic_im.png", package = "OpenImageR")

im = readImage(path)

dim(im)
# [1] 360 360   4

res = superpixels(input_image = im, method = "slic", superpixel = 200,

                  compactness = 20, return_slic_data = TRUE)

# Error: In interface_superpixels(input_image, method, superpixel, compactness,  :
#  The input data has more than 3 dimensions. The dimensions were reduced from 4 to 3!

I can not imagine an array with dim = c(x, y, 3) to store any 3-dimensional image...

My questions:

Most important: IS there a package providing to use SLIC at "real" 3-dimensional images?

For my curiosity: Why does the mentioned function restricts 3D images to dim = c(x, y, 3)?

0

There are 0 answers