diff --git a/.github/workflows/python-CD.yml b/.github/workflows/python-CD.yml index 8ae8996..9ab4d2c 100644 --- a/.github/workflows/python-CD.yml +++ b/.github/workflows/python-CD.yml @@ -12,8 +12,8 @@ on: branches: [master] jobs: format_and_check: - runs-on: ubuntu-20.04 - environment: production + runs-on: ubuntu-22.04 + environment: ${{ github.ref == 'refs/heads/master' && 'production' || 'staging' }} steps: - uses: actions/checkout@v3 - name: Set up Python @@ -30,11 +30,11 @@ jobs: build: needs: format_and_check - runs-on: ubuntu-20.04 - environment: production + runs-on: ubuntu-22.04 + environment: ${{ github.ref == 'refs/heads/master' && 'production' || 'staging' }} strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v3 @@ -62,8 +62,8 @@ jobs: deploy: needs: build - runs-on: ubuntu-20.04 - environment: production + runs-on: ubuntu-22.04 + environment: ${{ github.ref == 'refs/heads/master' && 'production' || 'staging' }} steps: - uses: actions/checkout@v3 - name: Set up Python @@ -97,8 +97,8 @@ jobs: release: needs: deploy - runs-on: ubuntu-20.04 - environment: production + runs-on: ubuntu-22.04 + environment: ${{ github.ref == 'refs/heads/master' && 'production' || 'staging' }} steps: - uses: actions/checkout@v3 - name: Set up Python @@ -128,8 +128,8 @@ jobs: deploy_docs: needs: build - runs-on: ubuntu-20.04 - environment: production + runs-on: ubuntu-22.04 + environment: ${{ github.ref == 'refs/heads/master' && 'production' || 'staging' }} steps: - uses: actions/checkout@v3 - name: Set up Python diff --git a/.github/workflows/python-CI.yml b/.github/workflows/python-CI.yml index df23ad8..d24c4a0 100644 --- a/.github/workflows/python-CI.yml +++ b/.github/workflows/python-CI.yml @@ -11,7 +11,7 @@ on: branches: [develop, feature/*] jobs: format_and_check: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 environment: development steps: - uses: actions/checkout@v3 @@ -29,11 +29,11 @@ jobs: build: needs: format_and_check - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 environment: development strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} diff --git a/.python-version b/.python-version deleted file mode 100644 index 251b350..0000000 --- a/.python-version +++ /dev/null @@ -1 +0,0 @@ -3.10.16 diff --git a/LICENSE b/LICENSE index 3ce9051..e6ab923 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2024, Caihao Cui +Copyright (c) 2025, Caihao Cui Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/README.md b/README.md index 25d4dae..5e89a1c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ [![image](https://img.shields.io/pypi/pyversions/splitraster)](https://python.org/pypi/splitraster) [![image](https://img.shields.io/pypi/v/splitraster?color=g)](https://python.org/pypi/splitraster) -[![CD](https://img.shields.io/github/actions/workflow/status/cuicaihao/split_raster/python-CD.yml?branch=master)](https://github.com/cuicaihao/split_raster/actions/workflows/python-CD.yml) +[![SplitRaster Developmnet Build Install and Test](https://github.com/cuicaihao/split_raster/actions/workflows/python-CI.yml/badge.svg?branch=develop)](https://github.com/cuicaihao/split_raster/actions/workflows/python-CI.yml) +[![SplitRaster Package Release and Publish](https://github.com/cuicaihao/split_raster/actions/workflows/python-CD.yml/badge.svg)](https://github.com/cuicaihao/split_raster/actions/workflows/python-CD.yml) [![DMonth](https://pepy.tech/badge/splitraster/month)](https://pepy.tech/project/splitraster) [![DTotal](https://pepy.tech/badge/splitraster?)](https://pepy.tech/project/splitraster) [![image](https://img.shields.io/github/license/cuicaihao/split_raster?color=blue)](https://python.org/pypi/splitraster) @@ -172,13 +173,7 @@ n = geo.random_crop_image(input_tif_image_path, input_save_image_path, gt_tif_i print(f"{n} sample paris of {input_tif_image_path, gt_tif_image_path} are added at {input_save_image_path, gt_save_image_path}.") ``` - -## Update Log -- 2024-Mar-23 Update github actions enable full CI/CD workflow, also add python 3.12 for build and test (https://pypi.org/project/splitraster/0.3.5/) -- 2023-Mar-19 Update github actions and add tutorial for the package. -- 2022-Dec-16 Upgrade the package to support python 3.8, 3.9, 3.10, 3.11 (https://pypi.org/project/splitraster/0.3.3). -- 2022-Jan-16 Fix bugs to make package suitable for python 3.7. Publish new version at(https://pypi.org/project/splitraster/0.3.2/) . - + ## Contribution Guidelines If you run into issues or have questions, please [open an issue](https://github.com/cuicaihao/split_raster/issues) or [submit a pull request](https://github.com/cuicaihao/split_raster/pulls). diff --git a/docs/index.md b/docs/index.md index ae3ef19..d756dbb 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,7 +2,8 @@ [![image](https://img.shields.io/pypi/pyversions/splitraster)](https://python.org/pypi/splitraster) [![image](https://img.shields.io/pypi/v/splitraster?color=g)](https://python.org/pypi/splitraster) -[![CD](https://img.shields.io/github/actions/workflow/status/cuicaihao/split_raster/python-CD.yml?branch=master)](https://github.com/cuicaihao/split_raster/actions/workflows/python-CD.yml) +[![SplitRaster Developmnet Build Install and Test](https://github.com/cuicaihao/split_raster/actions/workflows/python-CI.yml/badge.svg?branch=develop)](https://github.com/cuicaihao/split_raster/actions/workflows/python-CI.yml) +[![SplitRaster Package Release and Publish](https://github.com/cuicaihao/split_raster/actions/workflows/python-CD.yml/badge.svg)](https://github.com/cuicaihao/split_raster/actions/workflows/python-CD.yml) [![DMonth](https://pepy.tech/badge/splitraster/month)](https://pepy.tech/project/splitraster) [![DTotal](https://pepy.tech/badge/splitraster?)](https://pepy.tech/project/splitraster) [![image](https://img.shields.io/github/license/cuicaihao/split_raster?color=blue)](https://python.org/pypi/splitraster) diff --git a/models/.gitkeep b/models/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/references/.gitkeep b/references/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/reports/.gitkeep b/reports/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/reports/figures/.gitkeep b/reports/figures/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/setup.py b/setup.py index 4e0a6ad..9c74959 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ def read_requirements(): setup( name="splitraster", - version="0.3.6", + version="0.3.7", author="Chris Cui", license="MIT", platforms="any", @@ -21,24 +21,20 @@ def read_requirements(): url="https://github.com/cuicaihao/split_raster", package_dir={"": "src"}, project_urls={}, - packages=find_packages( - where="src", exclude=["data", "features", "models", "visualization"] - ), - python_requires=">=3.7, <3.13", + packages=find_packages(where="src", exclude=["data"]), + python_requires=">=3.7, <3.14", keywords="split raster tiling ", install_requires=read_requirements(), classifiers=[ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", - "License :: OSI Approved :: MIT License", - "Programming Language :: Python", - "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ], ) # rm -rf build dist diff --git a/src/environment.yml b/src/environment.yml deleted file mode 100644 index 8e0e932..0000000 --- a/src/environment.yml +++ /dev/null @@ -1,151 +0,0 @@ -name: py38_split_raster -channels: - - conda-forge - - defaults -dependencies: - - appdirs=1.4.4=pyh9f0ad1d_0 - - attrs=21.2.0=pyhd8ed1ab_0 - - blosc=1.21.0=he49afe7_0 - - boost-cpp=1.74.0=hff03dee_4 - - brotli=1.0.9=h0d85af4_5 - - brotli-bin=1.0.9=h0d85af4_5 - - brotlipy=0.7.0=py38h96a0964_1001 - - brunsli=0.1=h046ec9c_0 - - bzip2=1.0.8=h0d85af4_4 - - c-ares=1.17.2=h0d85af4_0 - - ca-certificates=2021.5.30=h033912b_0 - - cairo=1.16.0=he43a7df_1008 - - certifi=2021.5.30=py38h50d1736_0 - - cffi=1.14.6=py38h9688ba1_0 - - cfitsio=3.470=h01dc385_7 - - chardet=4.0.0=py38h50d1736_1 - - charls=2.2.0=h046ec9c_0 - - charset-normalizer=2.0.0=pyhd8ed1ab_0 - - cloudpickle=1.6.0=py_0 - - colorama=0.4.4=pyh9f0ad1d_0 - - cryptography=3.4.7=py38h1fa4640_0 - - curl=7.78.0=hb861fe1_0 - - cycler=0.10.0=py_2 - - cytoolz=0.11.0=py38h96a0964_3 - - dask-core=2021.7.2=pyhd8ed1ab_0 - - decorator=4.4.2=py_0 - - expat=2.4.1=he49afe7_0 - - fontconfig=2.13.1=h10f422b_1005 - - freetype=2.10.4=h4cff582_1 - - freexl=1.0.6=h0d85af4_0 - - fsspec=2021.7.0=pyhd8ed1ab_0 - - gdal=3.3.1=py38h140b4a6_1 - - geos=3.9.1=he49afe7_2 - - geotiff=1.6.0=h26421ea_6 - - gettext=0.19.8.1=h7937167_1005 - - giflib=5.2.1=hbcb3906_2 - - hdf4=4.2.15=hefd3b78_3 - - hdf5=1.10.6=nompi_hc5d9132_1114 - - icu=68.1=h74dc148_0 - - idna=3.1=pyhd3deb0d_0 - - imagecodecs=2021.7.30=py38h1d95394_0 - - imageio=2.9.0=py_0 - - iniconfig=1.1.1=pyh9f0ad1d_0 - - jpeg=9d=hbcb3906_0 - - json-c=0.15=hcb556a6_0 - - jxrlib=1.1=h35c211d_2 - - kealib=1.4.14=h31dd65d_2 - - kiwisolver=1.3.1=py38h12bbefe_1 - - krb5=1.19.2=hcfbf3a7_0 - - lcms2=2.12=h577c468_0 - - lerc=2.2.1=h046ec9c_0 - - libaec=1.0.5=he49afe7_0 - - libblas=3.9.0=11_osx64_openblas - - libbrotlicommon=1.0.9=h0d85af4_5 - - libbrotlidec=1.0.9=h0d85af4_5 - - libbrotlienc=1.0.9=h0d85af4_5 - - libcblas=3.9.0=11_osx64_openblas - - libcurl=7.78.0=hf45b732_0 - - libcxx=12.0.1=habf9029_0 - - libdap4=3.20.6=h3e144a0_2 - - libdeflate=1.8=h0d85af4_0 - - libedit=3.1.20191231=h0678c8f_2 - - libev=4.33=haf1e3a3_1 - - libffi=3.3=h046ec9c_2 - - libgdal=3.3.1=hd51e85c_1 - - libgfortran=5.0.0=9_3_0_h6c81a4c_23 - - libgfortran5=9.3.0=h6c81a4c_23 - - libglib=2.68.3=hd556434_0 - - libiconv=1.16=haf1e3a3_0 - - libkml=1.3.0=h8fd9edb_1014 - - liblapack=3.9.0=11_osx64_openblas - - libnetcdf=4.8.0=nompi_hb4d10b0_103 - - libnghttp2=1.43.0=h07e645a_0 - - libopenblas=0.3.17=openmp_h3351f45_1 - - libpng=1.6.37=h7cec526_2 - - libpq=13.3=hea3049e_0 - - librttopo=1.1.0=h5413771_6 - - libspatialite=5.0.1=h035f608_5 - - libssh2=1.9.0=h52ee1ee_6 - - libtiff=4.3.0=h1167814_0 - - libwebp-base=1.2.0=h0d85af4_2 - - libxml2=2.9.12=h93ec3fd_0 - - libzip=1.8.0=h8b0c345_0 - - libzopfli=1.0.3=h046ec9c_0 - - llvm-openmp=12.0.1=hda6cdc1_1 - - locket=0.2.0=py_2 - - lz4-c=1.9.3=he49afe7_1 - - matplotlib-base=3.4.2=py38hc7d2367_0 - - more-itertools=8.8.0=pyhd8ed1ab_0 - - ncurses=6.2=h2e338ed_4 - - networkx=2.6.2=pyhd8ed1ab_0 - - numpy=1.21.1=py38had91d27_0 - - olefile=0.46=pyh9f0ad1d_1 - - openjpeg=2.4.0=h6e7aa92_1 - - openssl=1.1.1k=h0d85af4_0 - - packaging=21.0=pyhd8ed1ab_0 - - pandas=1.3.1=py38h1f261ad_0 - - partd=1.2.0=pyhd8ed1ab_0 - - pcre=8.45=he49afe7_0 - - pillow=8.3.1=py38hee640a0_0 - - pip=21.2.3=pyhd8ed1ab_0 - - pixman=0.40.0=hbcb3906_0 - - pluggy=0.13.1=py38h50d1736_4 - - pooch=1.4.0=pyhd8ed1ab_0 - - poppler=21.03.0=h640f9a4_0 - - poppler-data=0.4.10=0 - - postgresql=13.3=he8fe76e_0 - - proj=8.0.1=h1512c50_0 - - py=1.10.0=pyhd3deb0d_0 - - pycparser=2.20=pyh9f0ad1d_2 - - pyopenssl=20.0.1=pyhd8ed1ab_0 - - pyparsing=2.4.7=pyh9f0ad1d_0 - - pysocks=1.7.1=py38h50d1736_3 - - pytest=6.2.4=py38h50d1736_0 - - python=3.8.10=h0e5c897_0_cpython - - python-dateutil=2.8.2=pyhd8ed1ab_0 - - python_abi=3.8=2_cp38 - - pytz=2021.1=pyhd8ed1ab_0 - - pywavelets=1.1.1=py38hc7193ba_3 - - pyyaml=5.4.1=py38h5406a74_0 - - readline=8.1=h05e3726_0 - - requests=2.26.0=pyhd8ed1ab_0 - - scikit-image=0.18.2=py38h1f261ad_0 - - scipy=1.7.1=py38hd329d04_0 - - setuptools=49.6.0=py38h50d1736_3 - - six=1.16.0=pyh6c4a22f_0 - - snappy=1.1.8=hb1e8313_3 - - sqlite=3.36.0=h23a322b_0 - - tifffile=2021.8.8=pyhd8ed1ab_0 - - tiledb=2.3.3=h8370e7a_0 - - tk=8.6.10=h0419947_1 - - toml=0.10.2=pyhd8ed1ab_0 - - toolz=0.11.1=py_0 - - tornado=6.1=py38h96a0964_1 - - tqdm=4.62.0=pyhd8ed1ab_0 - - tzcode=2021a=h0d85af4_2 - - tzdata=2021a=he74cb21_1 - - urllib3=1.26.6=pyhd8ed1ab_0 - - wheel=0.37.0=pyhd8ed1ab_0 - - xerces-c=3.2.3=h379762d_2 - - xz=5.2.5=haf1e3a3_1 - - yaml=0.2.5=haf1e3a3_0 - - zfp=0.5.5=he49afe7_5 - - zlib=1.2.11=h7795811_1010 - - zstd=1.5.0=h582d3a0_0 -prefix: /Users/caihaocui/opt/miniconda3/envs/py38_split_raster diff --git a/src/features/.gitkeep b/src/features/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/features/__init__.py b/src/features/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/features/build_features.py b/src/features/build_features.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/gui.py b/src/gui.py deleted file mode 100644 index 9e84490..0000000 --- a/src/gui.py +++ /dev/null @@ -1,65 +0,0 @@ -import PySimpleGUI as sg # Part 1 - The import - -# Define the window's contents - -default_input_image_path = "../data/raw/RGB.png" -default_output_folder_path = "../data/processed/RGB" - - -def TextLabel(text): - return sg.Text(text + ":", justification="r", size=(32, 1)) - - -layout = [ - # Part 2 - The Layout - [ - TextLabel("Path to input image"), - sg.Input(default_input_image_path, size=(32, 10), key="input"), - sg.FileBrowse(), - ], - [ - TextLabel("Path to output folder"), - sg.Input(default_output_folder_path, size=(32, 10), key="output"), - sg.FolderBrowse(), - ], - [ - TextLabel("Crop Size"), - sg.Combo([100, 200, 400], size=(32, 10), default_value=100, key="crop_size"), - ], - [ - TextLabel("repetition_rate"), - sg.Slider( - range=(0, 100), - orientation="h", - size=(32, 1), - default_value=0.0, - key="repetition_rate", - ), - ], - [sg.Output(size=(70, 20), key="-OUTPUT-")], - [sg.Button("Run"), sg.Button("Clear"), sg.Button("Exit")], -] - -# Create the window -window = sg.Window("Split Raster", layout) # Part 3 - Window Defintion - -# Display and interact with the Window -# Part 4 - Event loop or Window.read call -# Do something with the information gathered -counter = 0 -while True: # Event Loop - event, values = window.read(timeout=100) - if event in (sg.WIN_CLOSED, "Exit"): - break - if event == "Run": - print(counter, event, values) - counter += 1 - if event == "Clear": - values["input"] = "" - values["output"] = "" - window["-OUTPUT-"].update("") - counter = 0 - - -# Finish up by removing from the screen -window.close() diff --git a/src/local_run.py b/src/local_run.py deleted file mode 100644 index f9ca18a..0000000 --- a/src/local_run.py +++ /dev/null @@ -1,110 +0,0 @@ -# %% Example A: General image seg dataset -from splitraster import geo, io - - -# %% Example A: General image seg dataset - Slide Window Method -input_image_path = "../data/raw/RGB.png" -gt_image_path = "../data/raw/GT.png" - -input_save_path = "../data/processed/RGB" -gt_save_path = "../data/processed/GT" - -crop_size = 256 -repetition_rate = 0 -overwrite = True - -n = io.split_image( - input_image_path, - input_save_path, - crop_size, - repetition_rate=repetition_rate, - overwrite=overwrite, -) -print(f"{n} tiles sample of {input_image_path} are added at {input_save_path}") - -n = io.split_image( - gt_image_path, - gt_save_path, - crop_size, - repetition_rate=repetition_rate, - overwrite=overwrite, -) -print(f"{n} tiles sample of {gt_image_path} are added at {gt_save_path}") - - -# %% Example AA: General image seg dataset: Random Sampling Method -input_image_path = "../data/raw/RGB.png" -gt_image_path = "../data/raw/GT.png" - -input_save_path = "../data/processed/Rand/RGB" -gt_save_path = "../data/processed/Rand/GT" - -n = io.random_crop_image( - input_image_path, - input_save_path, - gt_image_path, - gt_save_path, - crop_size=256, - crop_number=20, - img_ext=".png", - label_ext=".png", - overwrite=True, -) - -print( - f"{n} sample paris of {input_image_path, gt_image_path} are added at {input_save_path, gt_save_path}." -) - - -# %% Example B: Remote Sensing image seg dataset - Slide Window Method - -input_tif_image_path = "../data/raw/TIF/RGB5k.tif" -gt_tif_image_path = "../data/raw/TIF/GT5k.tif" - -input_save_image_path = "../data/processed/RGB_TIF" -gt_save_image_path = "../data/processed/GT_TIF" - -crop_size = 500 -repetition_rate = 0 -overwrite = True - -n = geo.split_image( - input_tif_image_path, input_save_image_path, crop_size, repetition_rate, overwrite -) - -print( - f"{n} tiles sample of {input_tif_image_path} are added at {input_save_image_path}" -) - -n = geo.split_image( - gt_tif_image_path, gt_save_image_path, crop_size, repetition_rate, overwrite -) - -print(f"{n} tiles sample of {gt_tif_image_path} are added at {gt_save_image_path}") - -# %% Example B: Remote Sensing image seg dataset - Random Sampling Method -input_tif_image_path = "../data/raw/TIF/RGB5k.tif" -gt_tif_image_path = "../data/raw/TIF/GT5k.tif" - -input_save_image_path = "../data/processed/Rand/RGB_TIF" -gt_save_image_path = "../data/processed/Rand/GT_TIF" - -n = geo.random_crop_image( - input_tif_image_path, - input_save_image_path, - gt_tif_image_path, - gt_save_image_path, - crop_size=500, - crop_number=20, - overwrite=True, -) - -print( - f"{n} sample paris of {input_tif_image_path, gt_tif_image_path} are added at {input_save_image_path, gt_save_image_path}." -) - - -# %% - - -print("PASS") diff --git a/src/models/.gitkeep b/src/models/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/models/__init__.py b/src/models/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/models/predict_model.py b/src/models/predict_model.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/models/train_model.py b/src/models/train_model.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/visualization/.gitkeep b/src/visualization/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/visualization/__init__.py b/src/visualization/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/visualization/visualize.py b/src/visualization/visualize.py deleted file mode 100644 index e69de29..0000000