davidcsterratt / retistruct

Computational reconstruction and transformation of flattened retinae
http://davidcsterratt.github.io/retistruct/
7 stars 7 forks source link

Improve image handling #45

Open davidcsterratt opened 4 years ago

davidcsterratt commented 4 years ago

The aim of this proposal are:

  1. Make it easy to have multiple images in a directory and switch between them in the GUI
  2. Not save images in the r.Rdata files
  3. Read TIFF as well as PNG files

This could be achieved by:

  1. Modifying read.image() to read information about images in the directory. It would throw an error if all images do not have the same dimensions, and it would return a list of image file names, and the common dimensions.
  2. Store the dimensions in the Outline object
  3. Only load images at the time of rendering. The Outline function getImage() could be modified to take an argument (image file name), defaulting to the first in alphabetical order. This would then load the image, cache it in Outline$im and proceed as now. A record of the cached image name would be kept in the Outline object.

Ideally point (1) requires some code to read image metadata without reading the whole image.

davidcsterratt commented 4 years ago

The R magick package looks like it would provide the code for (1), and would also read various formats of image file: https://cran.r-project.org/web/packages/magick/index.html It does require Linux and Mac users to install the imagemagick libraries, but there are instructions on how to do this.