ropensci / colocr

An R package for conducting co-localization analysis. Edit
https://docs.ropensci.org/colocr
GNU General Public License v3.0
26 stars 3 forks source link

switching dependency to `magick` #4

Open MahShaaban opened 5 years ago

MahShaaban commented 5 years ago

Summary

As it stands, colocr is functional but switching the main dependency from imager to magick has been proposed https://github.com/ropensci/onboarding/issues/243#issuecomment-425357850. The two main changes would include:

The data structures

I am currently using two S3 classes from imager. These are cimg and pixset. Both are layers over arrays of numeric or logical values. The advantage here is that the two classes can be transformed from one to the other and math operations can be directly applied to them. magick-image is an externalptr and I think would relace cimg(I am not sure what to do about the pixset, or whether an equivalent would be needed at all). I am having a hard time getting data in and out of magick-image. This certainly needs more work on my part. I wish there were more information in the magick's vignette on how to manipulate the image objects. These changes will obviously affect all the functions in colocr as which objects they dispatch on, the way the manipulations are done and the return value.

Applying morphological operations

The main functions I use from imager are grow, shrink, fill and clean. In the development version of magick there is image_morphology() which can these operations and more https://github.com/ropensci/onboarding/issues/243#issuecomment-425673974. These changes would mainly affect roi_select().

Other

Two other functions I use from imager and still don't see how to replace them are