diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index be08ebde..3fe3090f 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -3,7 +3,7 @@ **FOR THE CONTRIBUTOR — Please fill out if applicable** -Please make sure you have read the [CONTRIBUTING.md](https://github.com/BMCV/galaxy-image-analysis/blob/master/CONTRIBUTING.md) document (last updated: 2024/03/18). +Please make sure you have read the [CONTRIBUTING.md](https://github.com/BMCV/galaxy-image-analysis/blob/master/CONTRIBUTING.md) document (last updated: 2024/04/23). * [ ] License permits unrestricted use (educational + commercial). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fb4a2e27..33d33848 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,7 +8,7 @@ This document is the attempt to collect some rough rules for tools to follow in * Make sure you have git [installed](https://help.github.com/articles/set-up-git) * Fork the repository on [GitHub](https://github.com/BMCV/galaxy-image-analysis/fork) * Make the desired modifications - consider using a [feature branch](https://github.com/Kunena/Kunena-Forum/wiki/Create-a-new-branch-with-git-and-manage-branches). -* Try to stick to the [Conventions for Tools in the Image Community](https://github.com/elixir-europe/biohackathon-projects-2023/blob/main/16/paper/paper.md#conventions) and the [IUC standards](http://galaxy-iuc-standards.readthedocs.org/en/latest/) whenever you can +* Try to stick to the [Conventions for Tools in the Image Community](https://doi.org/10.37044/osf.io/w8dsz) and the [IUC standards](http://galaxy-iuc-standards.readthedocs.org/en/latest/) whenever you can * Make sure you have added the necessary tests for your changes and they pass. * Open a [pull request](https://help.github.com/articles/using-pull-requests) with these changes. @@ -22,10 +22,10 @@ This document is the attempt to collect some rough rules for tools to follow in ## File types -If a tool wrapper only supports single-channel 2-D images and uses a Python script, the structure of the input should be verified right after loading the image: - +In tool wrappers which use a Python script, image loading should be performed by using the `giatools` package (see https://github.com/BMCV/galaxy-image-analysis/pull/119). +If such wrappers only support single-channel 2-D images, the structure of the input should be verified right after loading the image: ```python -im = skimage.io.imread(args.input) +im = giatools.io.imread(args.input) im = np.squeeze(im) # remove axes with length 1 assert im.ndim == 2 ``` @@ -33,7 +33,7 @@ assert im.ndim == 2 Tools with **label map inputs** should accept PNG and TIFF files. Tools with **label map outputs** should produce either `uint16` single-channel PNG or `uint16` single-channel TIFF. Using `uint8` instead of `uint16` is also acceptable, if there definetely are no more than 256 different labels. Using `uint8` should be preferred for binary images. > [!NOTE] -> It is a common misconception that PNG files must be RGB or RGBA, and that only `uint8` pixel values are supported. For example, the `cv2` module (OpenCV) can be used to create single-channel PNG files, or PNG files with `uint16` pixel values. Such files can then be read by `skimage.io.imread` without issues (however, `skimage.io.imwrite` seems not to be able to write such PNG files). +> It is a common misconception that PNG files must be RGB or RGBA, and that only `uint8` pixel values are supported. For example, the `cv2` module (OpenCV) can be used to create single-channel PNG files, or PNG files with `uint16` pixel values. Such files can then be read by `giatools.io.imread` or `skimage.io.imread` without issues (however, `skimage.io.imwrite` seems not to be able to write such PNG files). Tools with **intensity image inputs** should accept PNG and TIFF files. Tools with **intensity image outputs** can be any data type and either PNG or TIFF. Image outputs meant for visualization (e.g., segmentation overlays, charts) should be PNG. diff --git a/tools/2d_auto_threshold/auto_threshold.py b/tools/2d_auto_threshold/auto_threshold.py index 428547e7..38a68ccd 100644 --- a/tools/2d_auto_threshold/auto_threshold.py +++ b/tools/2d_auto_threshold/auto_threshold.py @@ -7,12 +7,13 @@ import argparse +import giatools.io import numpy as np import skimage.filters -import skimage.io import skimage.util import tifffile + th_methods = { 'manual': lambda thres, **kwargs: thres, @@ -28,7 +29,7 @@ def do_thresholding(in_fn, out_fn, th_method, block_size, offset, threshold, invert_output=False): - img = skimage.io.imread(in_fn) + img = giatools.io.imread(in_fn) img = np.squeeze(img) assert img.ndim == 2 diff --git a/tools/2d_auto_threshold/auto_threshold.xml b/tools/2d_auto_threshold/auto_threshold.xml index 02e5b247..ce999e69 100644 --- a/tools/2d_auto_threshold/auto_threshold.xml +++ b/tools/2d_auto_threshold/auto_threshold.xml @@ -4,7 +4,7 @@ creators.xml tests.xml 0.18.1 - 2 + 3 @@ -22,6 +22,7 @@ scikit-image tifffile + giatools + + + + + + + diff --git a/tools/2d_auto_threshold/test-data/out5.tif b/tools/2d_auto_threshold/test-data/out5.tif new file mode 100644 index 00000000..8f5c6e85 Binary files /dev/null and b/tools/2d_auto_threshold/test-data/out5.tif differ diff --git a/tools/2d_auto_threshold/test-data/sample2.tif b/tools/2d_auto_threshold/test-data/sample2.tif new file mode 100644 index 00000000..a506bb3b Binary files /dev/null and b/tools/2d_auto_threshold/test-data/sample2.tif differ diff --git a/tools/2d_feature_extraction/2d_feature_extraction.py b/tools/2d_feature_extraction/2d_feature_extraction.py index 4b3e0baa..3b7584dd 100644 --- a/tools/2d_feature_extraction/2d_feature_extraction.py +++ b/tools/2d_feature_extraction/2d_feature_extraction.py @@ -1,9 +1,9 @@ import argparse +import giatools.io import numpy as np import pandas as pd import skimage.feature -import skimage.io import skimage.measure import skimage.morphology import skimage.segmentation @@ -57,9 +57,9 @@ raw_image = None if args.raw_file is not None: - raw_image = skimage.io.imread(args.raw_file.name) + raw_image = giatools.io.imread(args.raw_file.name) - raw_label_image = skimage.io.imread(label_file) + raw_label_image = giatools.io.imread(label_file) df = pd.DataFrame() if label_file_binary: @@ -124,4 +124,4 @@ df['convexity'] = area / (perimeter * perimeter) del df['it'] - df.to_csv(out_file, sep='\t', line_terminator='\n', index=False) + df.to_csv(out_file, sep='\t', lineterminator='\n', index=False) diff --git a/tools/2d_feature_extraction/2d_feature_extraction.xml b/tools/2d_feature_extraction/2d_feature_extraction.xml index ebbc8bb3..2716e62a 100644 --- a/tools/2d_feature_extraction/2d_feature_extraction.xml +++ b/tools/2d_feature_extraction/2d_feature_extraction.xml @@ -2,7 +2,7 @@ with scikit-image creators.xml - 0.14.2 + 0.18.1 0 @@ -17,9 +17,10 @@ scikit-image - pandas - numpy - tifffile + pandas + numpy + tifffile + giatools float(a_max): diff --git a/tools/2d_filter_segmentation_by_features/2d_filter_segmentation_by_features.xml b/tools/2d_filter_segmentation_by_features/2d_filter_segmentation_by_features.xml index 8e6c3d67..f68c75c0 100644 --- a/tools/2d_filter_segmentation_by_features/2d_filter_segmentation_by_features.xml +++ b/tools/2d_filter_segmentation_by_features/2d_filter_segmentation_by_features.xml @@ -1,4 +1,4 @@ - + creators.xml @@ -14,10 +14,10 @@ galaxy_image_analysis - scikit-image - pillow - pandas - tifffile + scikit-image + pandas + tifffile + giatools creators.xml tests.xml - 0.14.2 + 0.18.1 0 @@ -18,9 +18,9 @@ scikit-image - numpy - pillow - tifffile + numpy + tifffile + giatools creators.xml tests.xml 1.12.0 - 0 + 1 @@ -20,6 +20,7 @@ numpy scikit-image tifffile + giatools +1] = +1 diff --git a/tools/anisotropic_diffusion/anisotropic_diffusion.xml b/tools/anisotropic_diffusion/anisotropic_diffusion.xml index 2dab21c5..4077414a 100644 --- a/tools/anisotropic_diffusion/anisotropic_diffusion.xml +++ b/tools/anisotropic_diffusion/anisotropic_diffusion.xml @@ -4,7 +4,7 @@ creators.xml tests.xml 0.4.0 - 0 + 1 @@ -16,6 +16,7 @@ medpy numpy scikit-image + giatools creators.xml tests.xml 3.2.1 - 1 + 2 @@ -16,6 +16,7 @@ networkx numpy scikit-image + giatools + creators.xml @@ -17,6 +17,7 @@ scikit-image numpy tifffile + giatools creators.xml tests.xml 1.26.4 - 1 + 2 @@ -15,6 +15,7 @@ numpy scikit-image + giatools creators.xml tests.xml 1.12.0 - 0 + 1 @@ -18,6 +18,7 @@ scipy scikit-image + giatools creators.xml 0.2.0.4 - 1 + 2 @@ -17,6 +17,7 @@ orientationpy scikit-image + giatools 3: @@ -72,8 +73,8 @@ def blending(im1_fn, im2_fn, out_fn, alpha=0.5): def seg_contour(im1_fn, im2_fn, out_fn, linewidth, color='#ff0000', show_label=False, label_color='#ffff00'): - img = skimage.io.imread(im1_fn) - labels = skimage.io.imread(im2_fn) + img = giatools.io.imread(im1_fn) + labels = giatools.io.imread(im2_fn) result = get_rgb8_copy(img) cp = ContourPaint(labels, linewidth, where='center') diff --git a/tools/overlay_images/overlay_images.xml b/tools/overlay_images/overlay_images.xml index 71069978..289834ed 100644 --- a/tools/overlay_images/overlay_images.xml +++ b/tools/overlay_images/overlay_images.xml @@ -4,7 +4,7 @@ creators.xml tests.xml 0.0.4 - 1 + 2 @@ -21,6 +21,7 @@ matplotlib tifffile numpy + giatools 2: hw_fixed = fixed.shape[-3:-1] else: diff --git a/tools/projective_transformation/projective_transformation.xml b/tools/projective_transformation/projective_transformation.xml index d164e9bb..2b40070f 100644 --- a/tools/projective_transformation/projective_transformation.xml +++ b/tools/projective_transformation/projective_transformation.xml @@ -4,7 +4,7 @@ creators.xml tests.xml 0.1.2 - 3 + 4 @@ -21,6 +21,7 @@ numpy scipy tifffile + giatools creators.xml tests.xml 0.18.3 - 0 + 1 @@ -21,6 +21,7 @@ pillow numpy tifffile + giatools + creators.xml @@ -14,10 +14,11 @@ galaxy_image_analysis - scikit-image - numpy - scipy - tifffile + scikit-image + numpy + scipy + tifffile + giatools + creators.xml @@ -14,9 +14,10 @@ galaxy_image_analysis - scikit-image - numpy - tifffile + scikit-image + numpy + tifffile + giatools creators.xml tests.xml 0.2.0 - 0 + 1 @@ -19,6 +19,7 @@ superdsm + giatools