diff cellpose.xml @ 0:130d15e15378 draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 81c31a317150556704cc02ac5f05eedb0a47e0b2
author bgruening
date Wed, 17 Dec 2025 17:21:56 +0000
parents
children bc1410a8a247
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cellpose.xml	Wed Dec 17 17:21:56 2025 +0000
@@ -0,0 +1,200 @@
+<tool id="cellposesam" name="Run generalist cell and nucleus segmentation" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="24.2">
+    <description>with Cellpose-SAM</description>
+    <macros>
+        <token name="@TOOL_VERSION@">4.0.7</token>
+        <token name="@VERSION_SUFFIX@">0</token>
+    </macros>
+    <requirements>
+        <requirement type="package" version="@TOOL_VERSION@">cellpose</requirement> 
+    </requirements>
+    <command detect_errors="exit_code">
+         <![CDATA[
+        export MKL_NUM_THREADS=1
+	    && mkdir ./output
+		&& ln -s '${img_in}' './image.${img_in.ext}'
+        
+        && cellpose --image_path ./image.${img_in.ext} --no_npy --savedir ./output
+		    
+        #if $save_png
+           --save_png 
+        #end if
+		    
+        #if $save_tif
+          --save_tif 
+	    #end if
+		    
+	    #if $save_flows
+          --save_flows 
+        #end if
+		    
+	    #if $save_outlines
+           --save_outlines 
+        #end if
+		    
+	    #if $use_gpu
+           --use_gpu 
+        #end if
+		    
+        #if $no_norm
+           --no_norm 
+        #end if
+		    
+	    #if $diameter
+            --diameter $diameter 
+        #end if
+		    
+	    #if $no_resample
+           --no_resample 
+        #end if
+		    
+	    --flow_threshold $flow_threshold 
+        --cellprob_threshold $cellprob_threshold 
+        --niter $niter 
+	    --anisotropy $anisotropy 
+
+        #if $do_3D
+	        --do_3D
+        #end if
+
+        #if $z_axis
+            --z_axis $z_axis
+	    #end if
+	
+	    #if $channel_axis
+            --channel_axis $channel_axis
+        #end if
+
+        #if $no_interp
+	        --no_interp
+        #end if
+	    
+        #if $exclude_on_edges
+            --exclude_on_edges
+        #end if
+
+	    #if $transformer 
+            --transformer
+	    #end if
+        > ./cp.log 2>&1 
+        ]]>
+    </command>
+    <configfiles>
+        <inputs name="inputs" />
+    </configfiles>
+    <inputs>
+	<param name="img_in" type="data" format="ome.tiff,tiff,jpg,png" label="Choose the image file for segmentation (usually after registration)">
+	    <validator type="dataset_metadata_in_range" metadata_name="frames" min="0" max="1" message="Input image is multi-frame, must be single-frame"/>
+	</param>
+	<param name="save_png" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Save masks as png?"/>
+	<param name="save_tif" type="boolean" truevalue="true" falsevalue="false" checked="true" label="Save masks as tiff?"/>
+	<param name="save_flows" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Save RGN images of flows when masks are saved?"/>
+	<param name="save_outlines" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Save RGB outline images when masks are saved"/>
+	<param name="z_axis" type="integer" optional="true" min="0" label="Z axis" help="The axis of the image which corresponds to the image channels and to the z axis, zero-based." />
+	<param name="channel_axis" type="integer" optional="true" min="0" label="Channel axis" help="The axis (0-based) of the image which corresponds to the image channels and to the z axis" />
+	<param name="use_gpu" type="boolean" checked="false" truevalue="true" falsevalue="false" label="Whether to use GPU?" />
+	<section name="options" title="Advanced Options" expanded="False">
+        <param name="no_norm" type="boolean" label="Do not normalize images" truevalue="true" falsevalue="false" checked="false"/>
+        <param name="diameter" type="float" optional="true" label="Cell or nuclei diameter in pixels" help="Use to resize cells to the training diameter. Leave blank for automated estimation."/>
+	    <param name="no_resample" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Disables flows/cellprob resampling to original image size before computing masks."
+		    help="Using this flag will make more masks more jagged with larger diameter settings."/>
+        <param name="no_interp" type="boolean" truevalue="true" falsevalue="false" checked="true" label="Interpolate when running dynamics."/>
+        <param name="flow_threshold" type="float" min="0" value="0.4" label="Flow error threshold (all cells with errors below threshold are kept) (not used for 3D)"/>
+        <param name="cellprob_threshold" type="float" value="0.0" label="Cell probability threshold (all pixels with prob above threshold kept for masks)"/>
+        <param name="niter" type="integer" min="0" value="0" label="Number of iterations"
+		    help="Number of iterations for dynamics for mask creation, default of 0 means it is proportional to diameter, set to a larger number like 2000 for very long ROIs"/>
+	    <param name="anisotropy" type="float" min="0" value="1.0" label="Anisotropy of volume in 3D"
+		help="By default, sets the number of iterations to be proportional to the ROI diameter. For longer ROIs, more iterations might be needed."/>
+        <param name="exclude_on_edges" type="boolean" checked="false" truevalue="true" falsevalue="false" label="Discard masks which touch edges of image?" />
+	    <param name="do_3D" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Whether to run 3D segmentation on 4D image input?"/>
+	    <param name="transformer" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Whether to use transformer backnone" help="pretrained model from Cellpose3 is transformer_cp3"/>
+    </section>
+        <param name="detailed_output" type="boolean" label="Detailed logging file?" help="If set, a CellPose log file will be generated." />
+    </inputs>
+    <outputs>
+        <data format="tiff" name="cp_tiff" from_work_dir="output/image_cp_masks.tif" label="Cellpose SAM masks in TIFF">
+	        <filter>save_tif</filter>
+	    </data>
+	    <data format="png" name="cp_png" from_work_dir="output/image_cp_masks.png" label="Cellpose SAM masks in PNG">
+	        <filter>save_png</filter>
+        </data>
+	    <data format="tiff" name="cp_flows" from_work_dir="output/image_flows_cp_masks.tif" label="RGB images of flows">
+            <filter>save_flows</filter>
+	    </data>
+	    <data format="tiff" name="cp_flows_dp" from_work_dir="output/image_dP_cp_masks.tif" label="RGB images of flows(dP)">
+            <filter>save_flows</filter>
+        </data>
+	    <data format="png" name="cp_outlines" from_work_dir="output/image_outlines_cp_masks.png" label="RGB outline images">
+            <filter>save_outlines</filter>
+        </data>
+	    <data format="txt" name="logs" from_work_dir="cp.log" label="CellPose log">
+            <filter>detailed_output</filter>
+        </data>
+    </outputs>
+    <tests>
+        <test expect_num_outputs="2">
+            <param name="img_in" value="image.png"/>
+	        <param name="save_png" value="true" />
+	        <param name="save_tif" value="true"/>
+            <output name="cp_tiff" file="image_cp_masks.tiff" compare="image_diff" metric="iou"/>
+	        <output name="cp_png" file="image_cp_masks.png" compare="image_diff" metric="iou"/>
+	    </test>
+        <test expect_num_outputs="1">
+	        <param name="img_in" value="image3d.tiff"/>
+            <param name="save_png" value="false"/>
+	        <param name="save_tif" value="true"/>
+	        <param name="use_gpu" value="true" />
+	        <param name="z_axis" value="0" />
+	        <section name="options">
+                <param name="do_3D" value="true" />
+		        <param name="no_interp" value="true" />
+		        <param name="niter" value="1"/>
+	        </section>
+            <output name="cp_tiff" file="image3d_cp_masks.tiff" compare="image_diff"/>
+        </test>
+        <test expect_num_outputs="5">
+	        <param name="img_in" value="image.png"/>
+            <param name="save_png" value="true"/>
+            <param name="save_tif" value="false"/>
+	        <param name="save_flows" value="true"/>
+	        <param name="save_outlines" value="true" />
+	        <param name="use_gpu" value="true" />
+	        <param name="detailed_output" value="true" />
+	        <output name="cp_png" file="image_cp_masks.png" compare="image_diff" metric="iou"/>
+            <output name="cp_flows" file="image_flows_cp_masks.tiff" compare="image_diff" />
+	        <output name="cp_flows_dp" file="image_dP_cp_masks.tiff" compare="image_diff" />
+	        <output name="cp_outlines" file="image_outlines_cp_masks.png" compare="image_diff"/>
+            <output name="logs" ftype='txt'>
+                <assert_contents>
+		            <has_text_matching expression="1.15G/1.15G" />
+                </assert_contents>
+            </output>
+        </test>
+	    <test expect_num_outputs="1">
+            <param name="img_in" value="image.png" />
+	        <param name="save_png" value="true" />
+	        <param name="save_tif" value="false" />
+	        <param name="use_gpu" value="true" />
+            <section name="options">
+                <param name="no_norm" value="false" />
+                <param name="no_resample" value="false" />
+                <param name="diameter" value="10" />
+                <param name="flow_threshold" value="0.5" />
+                <param name="cellprob_threshold" value="0.0" />
+                <param name="niter" value="10" />
+                <param name="anisotropy" value="1.0" />
+                <param name="do_3D" value="false" />
+	            <param name="transformer" value="false" />
+	        </section>
+            <param name="detailed_output" value="false" />
+	        <output name="cp_png" file="image_cp_masks1.png" compare="image_diff" metric="iou" eps="0.02" />
+	    </test>
+    </tests>
+    <help>
+        <![CDATA[
+        Cellpose-SAM: superhuman generalization for cellular segmentation
+        ]]>
+    </help>
+    <citations>
+        <citation type="doi">https://doi.org/10.1101/2025.04.28.651001</citation>
+    </citations>
+</tool>