Repository 'wsi_extract_top_view'
hg clone https://toolshed.g2.bx.psu.edu/repos/thomaswollmann/wsi_extract_top_view

Changeset 0:9f01fd145af4 (2019-01-07)
Next changeset 1:257397c40c25 (2019-01-16)
Commit message:
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/wsi_extract_top_view/ commit 42d972afdd700fccae1017c06efbfd06b9c96791
added:
test-data/CMU-1-Small-Region.svs
test-data/out.tif
wsi_extract_top_view.py
wsi_extract_top_view.xml
b
diff -r 000000000000 -r 9f01fd145af4 test-data/CMU-1-Small-Region.svs
b
Binary file test-data/CMU-1-Small-Region.svs has changed
b
diff -r 000000000000 -r 9f01fd145af4 test-data/out.tif
b
Binary file test-data/out.tif has changed
b
diff -r 000000000000 -r 9f01fd145af4 wsi_extract_top_view.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/wsi_extract_top_view.py Mon Jan 07 08:38:08 2019 -0500
[
@@ -0,0 +1,22 @@
+import argparse
+import openslide
+import os
+import fnmatch
+import skimage.io
+import numpy as np
+
+def wsi_extract_top_view(input_path, out_path):
+    img_raw = openslide.OpenSlide(input_path)
+    top_size = img_raw.level_dimensions[len(img_raw.level_dimensions)-1]
+    img_area = img_raw.read_region((0,0), len(img_raw.level_dimensions)-1, top_size)
+    img_area = np.asarray(img_area, dtype=np.uint8)
+    skimage.io.imsave(out_path, img_area, plugin="tifffile")
+
+
+if __name__ == "__main__":
+    parser = argparse.ArgumentParser()
+    parser.add_argument('input_file', type=argparse.FileType('r'), help='input file')
+    parser.add_argument('out_file', help='out file')
+    args = parser.parse_args()
+
+    wsi_extract_top_view(args.input_file.name, args.out_file)
b
diff -r 000000000000 -r 9f01fd145af4 wsi_extract_top_view.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/wsi_extract_top_view.xml Mon Jan 07 08:38:08 2019 -0500
[
@@ -0,0 +1,30 @@
+<tool id="wsi_extract_top_view" name="Extract Top View from WSI" version="0.1"> 
+  <description>Extracts top view from WSI</description>
+  <requirements> 
+    <requirement type="package" version="0.14.0" >scikit-image</requirement>
+    <requirement type="package" version="1.15.4">numpy</requirement>
+    <requirement type="package" version="1.1.1">openslide-python</requirement>
+    <requirement type="package" version="0.5">glob2</requirement>
+  </requirements>
+  <command> 
+        <![CDATA[
+        python "$__tool_directory__/wsi_extract_top_view.py" '$input' '$output'
+        ]]>
+  </command>
+  <inputs> 
+    <param name="input" type="data" format="svs,tif,ndpi,vms,vmu,scn,mrxs,tiff,svslide,bif" label="Whole Slice Image"/><!--formats taken as listed on https://openslide.org/api/python/-->
+  </inputs>
+  <outputs>
+    <data name="output" format="tiff"/>
+  </outputs>
+  <tests>
+    <test>
+     <param name="input" value="CMU-1-Small-Region.svs"/>
+      <output name="output" value="out.tif" ftype="tiff" compare="sim_size"/>
+    </test>
+  </tests>
+  <help>Extracts the top view from a whole-slice image, also known as virtual slide, which are high-resolution images used in digital pathology.</help>
+  <citations>
+      <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation>
+  </citations>
+</tool>