-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from AgPipeline/develop
Merging develop to main branch - no review
- Loading branch information
Showing
6 changed files
with
93 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
FROM ubuntu:18.04 | ||
FROM ubuntu:20.04 | ||
LABEL maintainer="Chris Schnaufer <[email protected]>" | ||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
# Add user | ||
RUN useradd -u 49044 extractor \ | ||
|
@@ -11,11 +12,11 @@ RUN chown -R extractor /home/extractor \ | |
RUN apt-get update && \ | ||
apt-get upgrade -y && \ | ||
apt-get install -y --no-install-recommends \ | ||
python3.7 \ | ||
python3.8 \ | ||
python3-pip && \ | ||
ln -sfn /usr/bin/python3.7 /usr/bin/python && \ | ||
ln -sfn /usr/bin/python3.7 /usr/bin/python3 && \ | ||
ln -sfn /usr/bin/python3.7m /usr/bin/python3m && \ | ||
ln -sfn /usr/bin/python3.8 /usr/bin/python && \ | ||
ln -sfn /usr/bin/python3.8 /usr/bin/python3 && \ | ||
ln -sfn /usr/bin/python3.8m /usr/bin/python3m && \ | ||
apt-get autoremove -y && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
@@ -32,13 +33,13 @@ RUN apt-get update && \ | |
libgdal-dev \ | ||
gcc \ | ||
g++ \ | ||
python3.7-dev && \ | ||
python3.8-dev && \ | ||
python3 -m pip install --upgrade --no-cache-dir \ | ||
wheel && \ | ||
python3 -m pip install --upgrade --no-cache-dir \ | ||
numpy && \ | ||
python3 -m pip install --upgrade --no-cache-dir \ | ||
pygdal==2.2.3.* && \ | ||
pygdal==3.0.4.* && \ | ||
python3 -m pip install --upgrade --no-cache-dir \ | ||
opencv-python && \ | ||
apt-get remove -y \ | ||
|
@@ -83,4 +84,3 @@ RUN chmod a+x /home/extractor/soilmask.py | |
|
||
USER extractor | ||
ENTRYPOINT ["/home/extractor/soilmask.py"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
%YAML 1.1 | ||
--- | ||
pipeline: | ||
studyName: 'S7_20181011' | ||
season: 'S7_20181011' | ||
germplasmName: Sorghum bicolor | ||
collectingSite: Maricopa | ||
observationTimeStamp: '2018-10-11T13:01:02-08:00' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env python3 | ||
"""Python script for comparing two images they way we want them to be | ||
""" | ||
|
||
import argparse | ||
import PIL.Image | ||
import numpy as np | ||
|
||
|
||
def _get_params() -> tuple: | ||
"""Get the paths to the files | ||
Returns: | ||
A tuple containing the two paths | ||
""" | ||
parser = argparse.ArgumentParser(description='Compares two image files by size and pixel value') | ||
|
||
parser.add_argument('first_file', type=argparse.FileType('r'), help='The first image file to compare') | ||
parser.add_argument('second_file', type=argparse.FileType('r'), help='The second image file to compare') | ||
|
||
args = parser.parse_args() | ||
|
||
return args.first_file.name, args.second_file.name | ||
|
||
|
||
def check_images(first_path: str, second_path: str) -> None: | ||
"""Compares the two image files and throws an exception if they don't match | ||
Arguments: | ||
first_path: the path to the first file to compare | ||
second_path: the path to the second file to compare | ||
""" | ||
first_pixels = PIL.Image.open(first_path) | ||
first_array = np.array(first_pixels) | ||
del first_pixels | ||
|
||
second_pixels = PIL.Image.open(second_path) | ||
second_array = np.array(second_pixels) | ||
del second_pixels | ||
|
||
if first_array.shape != second_array.shape: | ||
raise RuntimeError("Image dimensions are different: %s vs %s" % (str(first_array.shape), str(second_array.shape))) | ||
|
||
for i in range(0, first_array.shape[0]): | ||
for j in range(0, first_array.shape[1]): | ||
for k in range(0, first_array.shape[2]): | ||
if first_array[i][j][k] - second_array[i][j][k] != 0: | ||
raise RuntimeError("Image pixels are different. First difference at %s %s %s" % (str(i), str(j), str(k))) | ||
|
||
|
||
if __name__ == '__main__': | ||
path1, path2 = _get_params() | ||
check_images(path1, path2) |