Skip to content

Commit

Permalink
save tif in addition to mp4
Browse files Browse the repository at this point in the history
  • Loading branch information
lldelisle committed Dec 20, 2024
1 parent 3c3c4d7 commit e7cda3e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import emblcmci.BleachCorrection_ExpoFit
import ij.IJ
import ij.ImagePlus
import ij.ImageStack
import ij.io.FileSaver
import ij.gui.Overlay
import ij.gui.TextRoi
import ij.measure.Calibration
Expand All @@ -17,6 +18,7 @@ import ij.util.FontUtil

import java.awt.*
import java.awt.GraphicsEnvironment
import java.io.File
import java.time.Duration
import java.time.LocalDateTime
import java.time.LocalTime
Expand Down Expand Up @@ -322,6 +324,11 @@ if (display_scalebar) {
if (! GraphicsEnvironment.isHeadless()){
final_imp.show()
}
// Save tiff
def fs = new FileSaver(final_imp)
File output_path = new File (imp.getTitle() + ".tif" )
fs.saveAsTiff(output_path.toString() )
// Save movie
AVI_Writer avi_writer = new AVI_Writer()
Calibration cal = final_imp.getCalibration()
cal.fps = frame_per_second
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<tool id="hyperstack_to_bleach_corrected_movie" name="Generate movie from hyperstack" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.01" license="MIT">
<description>with bleach correction</description>
<macros>
<token name="@TOOL_VERSION@">20230328</token>
<token name="@TOOL_VERSION@">20241220</token>
<token name="@VERSION_SUFFIX@">0</token>
<xml name="bleach_param">
<param name="media_change_points" type="text" value="" label="Indices of frames just before the media was changed separated by comma (1-based excluding last index)">
Expand All @@ -24,6 +24,7 @@
<command detect_errors="exit_code"><![CDATA[
ImageJ --ij2 --headless --console --run '$__tool_directory__/'bleach_correction_movie.groovy
'image_filename="${image_filename}",starting_time_hour="${starting_time_hour}",x="${x}",y="${y}",frame_per_second="${frame_per_second}",bleach_cor_channel="${bleach_cor.bleach_cor_channel}",media_change_points="${bleach_cor.media_change_points}",normalize_to_first_chunk="${bleach_cor.normalize_to_first_chunk}",channels_in_film_comma="${channels_in_film}",display_scalebar="${scalebar.display_scalebar}",scale="${scalebar.scale}",min_grey="${minmax.min_grey}",max_grey="${minmax.max_grey}",min_green="${minmax.min_green}",max_green="${minmax.max_green}",min_red="${minmax.min_red}",max_red="${minmax.max_red}"' > output.log
&& mv *.tif Movie.tif
&& ffmpeg -i *avi -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2,format=yuv420p" Movie.mp4
]]></command>
<inputs>
Expand Down Expand Up @@ -82,6 +83,7 @@
<outputs>
<data name="logfile" format="txt" from_work_dir="output.log" label="${tool.name} on ${on_string}: logfile" />
<data name="movie" format="mp4" from_work_dir="Movie.mp4" label="${tool.name} on ${on_string}: movie" />
<data name="image" format="tiff" from_work_dir="Movie.tif" label="${tool.name} on ${on_string}: image" />
</outputs>
<tests>
<!-- <test>
Expand Down

0 comments on commit e7cda3e

Please sign in to comment.