Skip to content
Snippets Groups Projects
Commit 52db9700 authored by Christopher Schmied's avatar Christopher Schmied
Browse files

Tested for single channel and dual channel

Varying z-slices should be possible now, loads them automatically
But not tested yet
parent ac82c53e
No related branches found
No related tags found
No related merge requests found
...@@ -22,7 +22,6 @@ do ...@@ -22,7 +22,6 @@ do
-Dfirst_czi_name=${first_czi_name} \ -Dfirst_czi_name=${first_czi_name} \
-Dtimepoint=${timepoint} \ -Dtimepoint=${timepoint} \
-Dangle=${angle} \ -Dangle=${angle} \
-Dstack_size=${stack_size} \
-Dpad=${pad} \ -Dpad=${pad} \
-Dtif_timepoint=${tif_timepoint} \ -Dtif_timepoint=${tif_timepoint} \
-- --no-splash ${resaving}" >> "${job}" -- --no-splash ${resaving}" >> "${job}"
......
...@@ -39,15 +39,11 @@ System.out.println( "=======================================================" ); ...@@ -39,15 +39,11 @@ System.out.println( "=======================================================" );
System.out.println( "Opening Image" ) ; System.out.println( "Opening Image" ) ;
IJ.run("Bio-Formats Importer", IJ.run("Bio-Formats Importer",
"open=" + dir + first_czi_name + " " + "open=" + dir + first_czi_name + " " +
"autoscale " +
"color_mode=Default " + "color_mode=Default " +
"specify_range " + "specify_range " +
"view=[Standard ImageJ] " + "view=[Standard ImageJ] " +
"stack_order=XYCZT " + "stack_order=XYCZT " +
"series_" + angle + " " + "series_" + angle + " " +
"z_begin_" + angle + "=1 " +
"z_end_" + angle + "=" + stack_size + " " +
"z_step_" + angle + "=1 " +
"t_begin_" + angle + "=" + timepoint + " " + "t_begin_" + angle + "=" + timepoint + " " +
"t_end_" + angle + "=" + timepoint + " " + "t_end_" + angle + "=" + timepoint + " " +
"t_step_" + angle + "=1"); "t_step_" + angle + "=1");
......
...@@ -14,12 +14,10 @@ ...@@ -14,12 +14,10 @@
# REVISION: 2015-07-05 # REVISION: 2015-07-05
# #
# Preprocessing # Preprocessing
# 1) rename .czi files # resave single channel and dual channel .czi files into .tif
# 2) resave .czi files into .tif or .zip # output: img_TL{t}_Angle{a}.tif
# 3) resave ome.tiff files into .tif # channels are 0,1 etc
# 4) Splitting output for Channel is #
# c=0,1 etc
# spim_TL{tt}_Angle{a}_Channel{c}.tif
#=============================================================================== #===============================================================================
image_file_directory="/projects/pilot_spim/Christopher/cluster_test_HisYFP/2013-11-14_His-YFP_2/" image_file_directory="/projects/pilot_spim/Christopher/cluster_test_HisYFP/2013-11-14_His-YFP_2/"
...@@ -34,7 +32,6 @@ job_directory="/projects/pilot_spim/Christopher/snakemake-workflows/spim_registr ...@@ -34,7 +32,6 @@ job_directory="/projects/pilot_spim/Christopher/snakemake-workflows/spim_registr
first_czi_name="2013-11-14_His-YFP_2.czi" first_czi_name="2013-11-14_His-YFP_2.czi"
timepoints="`seq 1 2`" # number of time points format: "`seq 0 1`" timepoints="`seq 1 2`" # number of time points format: "`seq 0 1`"
angles="1 2 3 4 5" # angles format: "1 2 3" angles="1 2 3 4 5" # angles format: "1 2 3"
stack_size="142"
pad="2" # for padded zeros pad="2" # for padded zeros
first_timepoint="0" # Starts with 0 first_timepoint="0" # Starts with 0
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
...@@ -49,12 +46,4 @@ Fiji="/sw/users/schmied/packages/2015-06-30_Fiji.app.cuda/ImageJ-linux64" ...@@ -49,12 +46,4 @@ Fiji="/sw/users/schmied/packages/2015-06-30_Fiji.app.cuda/ImageJ-linux64"
#--- Resaving .czi into .tif files---------------------------------------------- #--- Resaving .czi into .tif files----------------------------------------------
jobs_resaving=${job_directory}"czi_resave" # directory .czi resaving jobs_resaving=${job_directory}"czi_resave" # directory .czi resaving
resaving=${jobs_resaving}"/resaving.bsh" # script .czi resaving resaving=${jobs_resaving}"/resaving.bsh" # script .czi resaving
#--- Resaving ome.tiff into .tif files -----------------------------------------
jobs_resaving_ometiff=${job_directory}"ometiff_resave" # directory .ome.tiff resaving
resaving_ometiff=${jobs_resaving_ometiff}"/resaving-ometiff.bsh" # script .ome.tiff resaving
#--- Compress dataset;----------------------------------------------------------
jobs_compress=${job_directory}"compress" # directory .czi to .zip resaving
czi_compress=${jobs_compress}"/for_czi.bsh" # script .czi to .zip resaving
#--- Split channels-------------------------------------------------------------
jobs_split=${job_directory}"split_channels" # directory
split=${jobs_split}"/split.bsh" # script
#!/bin/bash
# path of master file
source master_preprocessing.sh
# path of source and target files
source_pattern=${image_file_directory}${source_pattern}
target_pattern=${image_file_directory}${target_pattern}
# ------------------------------------------------------------------------------
i=${first_index}
t=${first_timepoint}
t=`printf "%0${pad}d" "${t}"`
while [ $i -le $last_index ]; do
for a in "${angles_renaming[@]}"; do
source=${source_pattern/\{index\}/${i}}
tmp=${target_pattern/\{timepoint\}/${t}}
target=${tmp/\{angle\}/${a}}
echo ${source} ${target} # displays source file and target file with path
#mv ${source} ${target} # renames source file into target pattern
cp ${source} ${target} # alternatively copy source file and resave into target pattern
let i=i+1
done
let t=t+1
t=`printf "%0${pad}d" "${t}"`
done
#!/bin/bash
source ../master_preprocessing.sh
mkdir -p ${jobs_split}
for i in $parallel_timepoints
do
for a in $angle_prep
do
job="$jobs_split/split-$i-$a.job"
echo $job
echo "#!/bin/bash" > "$job"
echo "$XVFB_RUN $sysconfcpus $Fiji \
-Dimage_file_directory=$image_file_directory \
-Dparallel_timepoints=$i \
-Dangle_prep=$a \
-Dpad=$pad \
-Dtarget_split=$image_file_directory \
-- --no-splash \
$split" >> "$job"
chmod a+x "$job"
done
done
import ij.IJ;
import ij.ImagePlus;
import ij.ImageStack;
import java.lang.Runtime;
import java.io.File;
import java.io.FilenameFilter;
runtime = Runtime.getRuntime();
image_file_directory = System.getProperty( "image_file_directory" );
int parallel_timepoints = Integer.parseInt( System.getProperty( "parallel_timepoints" ) );
angle_prep = System.getProperty( "angle_prep" );
target_split = System.getProperty( "target_split" );
int pad = Integer.parseInt( System.getProperty( "pad" ) );
System.out.println( "directory = " + image_file_directory );
System.out.println( "timpoint = " + parallel_timepoints );
System.out.println( "angles = " + angle_prep );
System.out.println( "target_split = " + target_split );
System.out.println( "pad = " + pad );
//open image
imp = new ImagePlus( image_file_directory + "spim_TL" + IJ.pad( parallel_timepoints , pad ) + "_Angle" + angle_prep + ".tif" );
System.out.println( imp.getTitle() );
/* split channels */
stack = imp.getStack();
for ( c = 0; c < imp.getNChannels(); ++c )
{
channelStack = new ImageStack( imp.getWidth(), imp.getHeight() );
for ( z = 0; z < imp.getNSlices(); ++z )
channelStack.addSlice(
"",
stack.getProcessor(
imp.getStackIndex( c + 1, z + 1, 1 ) ) );
impc = new ImagePlus( imp.getTitle() + " #" + ( c + 1 ), channelStack );
IJ.save( impc, target_split + imp.getTitle().replaceFirst( ".tif$", "_Channel" + ( c ) + ".tif" ) );
}
/* shutdown */
runtime.exit(0);
#!/bin/bash
for file in `ls ${1} | grep ".job$"`
do
bsub -q short -n 3 -R span[hosts=1] -o "out.%J" -e "err.%J" ${1}/$file
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment