Image reduction for Correlator

Overview

This is a temporary workflow until the JRSO has the opportunity to integrate image reduction in the Correlation Downloader application.

To use images in the Correlator 4 application, you need to:

  1. Retrieve the correct images from the LIMS via LORE;

  2. Place the images in a specifically named R directory;

  3. Run the provided R script to reduce and rename the images;

  4. Place the reduced images in the correlation data directory from where the Correlator app will import them.

Your Desktop directory

You can organize your workspace as you like. However, the image reduction process requires that the file path in the provided R script match your directory. Your will also manage quite a bit of data so keeping things orderly helps. Here is a recommended structure for the overall process.

  • Desktop

    • Data from LIMS for Correlator (the folder Correlator will remember to look at for data updates)

      • Site U###1 (has files for each hole and datatype for a site, and a folder for each hole with reduced images)

        • Hole A data type 1 file

        • Hole A data type 2 file

        • ...

        • Hole B data type 1 file

        • Hole B data type 2 file

        • ...

        • Hole A image folder

        • Hole B image folder

        • ....

      • Site U###2

        • .....

      • Peter's play data (a subdirectory with legacy data to exercise)

    • Image reduction for Correlator

      • ImageResample_input (has hole folders with large images downloaded via LORE)

        • SiteHole A folder with images

        • SiteHole B folder with images

        • ...

      • ImageResample_output (has hole folders with reduced and renames images for Correlator)

        • SiteHole A folder with images

        • SiteHole B folder with images

        • ...

      • ImageResample.R (the script that reads from input folder and writes to output folder)

    • Correlation plots (your plots of the correlation results using whatever tool you like, e.g., Kaleidagraph)

      • Site U###1

        • your plots

      • Site U###2

        • your plots

      • ...

Retrieve images from LORE

  • Go to the LORE page at

  • Select the Images > Core Section (LSIMG) > Standard report

  • Select the hole for which you want to reduce the section half images

  • Click View data, then click Batch download linked files

  • When prompted, click Cropped image (JPG link)

  • Click the Chose a link button.

    • A zip file with all the images will be written to whatever download folder your workstation has configured.

  • Place the unzipped hole folder with images in the folder for processing (see overall directory structure above):

    • Image reduction for Correlator

      •  ImageResample_input

    • Note: you can keep the hole folders or delete them when you are done processing the images for the hole. Just make sure only one is not commented out in the script.

Run the R script

Open the ImageResamle.R script (method depends somewhat on OS and whether you use Rstudio or not).

First time you use the script:

  • If you name your top directories differently from what is shown above, you may need to adjust the file paths in the script.

    • Ask your friendly IT technician if you struggle with directory paths.

    • Once this is set correctly, it should not bother you for the remainder of the project.

Each time you run another batch of images, you need to add or edit a line in the script (see section '1.3. Set the test'):

  • Typically, a test means running all image files of a hole, but it could also be any subset of images. Thus, you typically want:

    •  test="U1476A"

    • Note quotation marks!

    • The test name must exactly match a subfolder name in the ImageResample_input folder.

  • You can overwrite the hole name for each test, or you can add test lines: the last one that is not commented out will be executed, i.e.:

    • #test="U1476A"     #Will be skipped

    • #test="U1476B"     #Will be skipped

    • test="U1476C"      #Will be executed

Run the script:

  • Save the changes to the script (recommended).

  • Select all and press command-return (or click the RUN button in RStudio).

  • Get coffee and a cookie while the program will:

    • Loop through the test (hole) input directory to load and process one image at a time.

    • Crop the images by 200 pixels on each side (can be changed to any number of pixels in the script).

    • Scale the images to 25% (targeting ~200 kb per image, can be set at any percentage in the script).

    • Rename the image files to a simpler section half ID.

    • Write the reduced file to the ImageResample_output folder. 

  • You should find the reduced images in the ImageResample_output folder.

    • Images should each be in the order of ~200 kb, which is the maximum that Correlator is set to display.

    • Note: The output file size is based on the latest camera resolution and the reduction parameters set in the script. If you are working with older images that had half (one quarter) of that resolution, the parameters might have to be adjusted in the script.

Move the reduced images into the Correlator site folder

Now move your test (hole) folder with the reduced images from the ImageResample_output folder into the appropriate site data folder from where Correlator will import them:

  • Desktop

    • Data from LIMS for Correlator

      • Site U###N

        • SiteHole N (folder with reduced images)

THE END!