# HG changeset patch # User imgteam # Date 1699626192 0 # Node ID 0a53256b48c6a596fb7800c783b60753bd7bd55d # Parent 5791a7f652752b2df8a844e491c06e5332e4cc32 planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/2d_feature_extraction/ commit 6b687746bdb3d5d1fb11ecffd6dd1bf42dc2c38d diff -r 5791a7f65275 -r 0a53256b48c6 2d_feature_extraction.py --- a/2d_feature_extraction.py Wed Dec 18 05:00:56 2019 -0500 +++ b/2d_feature_extraction.py Fri Nov 10 14:23:12 2023 +0000 @@ -1,17 +1,18 @@ import argparse + import numpy as np import pandas as pd +import skimage.feature import skimage.io import skimage.measure -import skimage.feature +import skimage.morphology import skimage.segmentation -import skimage.morphology -#TODO make importable by python script +# TODO make importable by python script parser = argparse.ArgumentParser(description='Extract Features 2D') -#TODO create factory for boilerplate code +# TODO create factory for boilerplate code features = parser.add_argument_group('compute features') features.add_argument('--all', dest='all_features', action='store_true') features.add_argument('--label', dest='add_label', action='store_true') @@ -19,7 +20,7 @@ features.add_argument('--max_intensity', dest='max_intensity', action='store_true') features.add_argument('--mean_intensity', dest='mean_intensity', action='store_true') features.add_argument('--min_intensity', dest='min_intensity', action='store_true') -features.add_argument('--moments_hu', dest='moments_hu', action='store_true') +features.add_argument('--moments_hu', dest='moments_hu', action='store_true') features.add_argument('--centroid', dest='centroid', action='store_true') features.add_argument('--bbox', dest='bbox', action='store_true') features.add_argument('--area', dest='area', action='store_true') @@ -41,13 +42,13 @@ parser.add_argument('--label_file_binary', dest='label_file_binary', action='store_true') parser.add_argument('--raw', dest='raw_file', type=argparse.FileType('r'), - help='Original input file', required=False) + help='Original input file', required=False) parser.add_argument('label_file', type=argparse.FileType('r'), - help='Label input file') + help='Label input file') parser.add_argument('output_file', type=argparse.FileType('w'), - help='Tabular output file') + help='Tabular output file') args = parser.parse_args() - + label_file_binary = args.label_file_binary label_file = args.label_file.name out_file = args.output_file.name @@ -70,7 +71,7 @@ df['image'] = df['it'].map(lambda ait: regions[ait].image.astype(np.float).tolist()) df['intensity_image'] = df['it'].map(lambda ait: regions[ait].intensity_image.astype(np.float).tolist()) -#TODO no matrix features, but split in own rows? +# TODO no matrix features, but split in own rows? if args.add_label or args.all_features: df['label'] = df['it'].map(lambda ait: regions[ait].label) @@ -119,7 +120,7 @@ if args.convexity or args.all_features: perimeter = df['it'].map(lambda ait: regions[ait].perimeter) area = df['it'].map(lambda ait: regions[ait].area) - df['convexity'] = area/(perimeter*perimeter) + df['convexity'] = area / (perimeter * perimeter) del df['it'] df.to_csv(out_file, sep='\t', line_terminator='\n', index=False) diff -r 5791a7f65275 -r 0a53256b48c6 2d_feature_extraction.xml --- a/2d_feature_extraction.xml Wed Dec 18 05:00:56 2019 -0500 +++ b/2d_feature_extraction.xml Fri Nov 10 14:23:12 2023 +0000 @@ -1,5 +1,12 @@ - - Feature Extraction + + with scikit-image + + operation_3443 + + + scikit-image + scikit-image + pandas scikit-image