Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
platy-browser-data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christian Tischer
platy-browser-data
Commits
af3e489f
Commit
af3e489f
authored
5 years ago
by
Constantin Pape
Browse files
Options
Downloads
Patches
Plain Diff
Add Hernando's prospr transfer scripts
parent
2d57471c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
registration/transfer_ProSPr_data/ProSPr_copy_and_mirror.ijm
+120
-0
120 additions, 0 deletions
registration/transfer_ProSPr_data/ProSPr_copy_and_mirror.ijm
registration/transfer_ProSPr_data/ProSPr_copy_and_mirror.sh
+21
-0
21 additions, 0 deletions
registration/transfer_ProSPr_data/ProSPr_copy_and_mirror.sh
with
141 additions
and
0 deletions
registration/transfer_ProSPr_data/ProSPr_copy_and_mirror.ijm
0 → 100644
+
120
−
0
View file @
af3e489f
// Copy files from ProSPr to the EM working directory
// Mirror in the x axis (because the SP8 does it)
// Add dimension information
// Threshold them (Not the reference)
// Manage names
// Hernando MV. Sep2019
setBatchMode(true);
// directory of the curated MEDs
meds_dir = "/g/arendt/PrImR/ProSPr6/4SPM_Binarization/CuratedMEDs_Good/";
// ProSPr reference
ref_file = "/g/arendt/PrImR/ProSPr6/ProSPr6_Ref.tif";
// segmented data
trackem_dir = "/g/arendt/PrImR/ProSPr6/TrackEM/";
// output directory
outdir = "/g/arendt/EM_6dpf_segmentation/platy-browser-data/data/rawdata/prospr/";
// read dictionary
dic_file = "/g/arendt/EM_6dpf_segmentation/GenerationOfVirtualCells/ProSPr_VirtualCells/helper_files/OlegGenesDiccionary.txt";
filestring=File.openAsString(dic_file);
rows=split(filestring, "\n");
badname=newArray(rows.length);
goodname=newArray(rows.length);
for(i=0; i<rows.length; i++){
columns=split(rows[i],",");
badname[i]=columns[0];
goodname[i]=columns[1];
}
// get a list of the med files
meds_files = getFileList(meds_dir);
filenames = newArray();
for (i=0;i<meds_files.length;i++){
subfiles = getFileList(meds_dir+meds_files[i]);
for (j=0;j<subfiles.length;j++){
if (endsWith(subfiles[j],"_MEDs.tif")){
pieces = split(subfiles[j],"_");
// avoid inserting Pty2
if (pieces[0] != "Pty2"){
filenames = Array.concat(filenames,meds_dir+meds_files[i]+"/"+subfiles[j]);
}
}
}
}
// add the segmented data
trackem_files = getFileList(trackem_dir);
for (i=0;i<trackem_files.length;i++){
subfiles = getFileList(trackem_dir+trackem_files[i]);
for (j=0;j<subfiles.length;j++){
if (endsWith(subfiles[j],"_MEDs.tif")){
pieces = split(subfiles[j],"_");
// avoid inserting MB
if (pieces[0] != "MB"){
filenames = Array.concat(filenames,trackem_dir+trackem_files[i]+"/"+subfiles[j]);
}
}
}
}
for (i = 0; i < filenames.length; i++) {
// open
open(filenames[i]);
f_name = getTitle();
print(f_name);
// flip
run("Flip Horizontally", "stack");
// change properties
run("Properties...", "channels=1 slices=251 frames=1 unit=micrometers pixel_width=0.55 pixel_height=0.55 voxel_depth=0.55");
// threshold
setThreshold(1, 255);
setOption("BlackBackground", false);
run("Convert to Mask", "stack");
// save
// parse title
pieces = split(f_name, "_");
// find index of name
idx = getIndex(pieces[0], badname);
print(idx);
// get correspondent name
if(idx<9000){
genename = goodname[idx];
print(genename);
new_name = pieces[0] + "-" + genename + "--prosprspaceMEDs.tif";
}
else{
new_name = pieces[0] + "--prosprspaceMEDs.tif";
}
// correct Hox5
if(pieces[0]=="Hox5"){
new_name = "Hox4--prosprspaceMEDs.tif";
}
saveAs("Tiff", outdir + new_name);
close(new_name);
}
// copy the reference
open(ref_file);
print(getTitle());
// flip
run("Flip Horizontally", "stack");
// change properties
run("Properties...", "channels=1 slices=251 frames=1 unit=micrometers pixel_width=0.55 pixel_height=0.55 voxel_depth=0.55");
// save
new_name = "ProSPr6-Ref--prosprspaceMEDs.tif";
saveAs("Tiff", outdir + new_name);
close(new_name);
run("Close All");
print("DONE");
run("Quit");
function getIndex(word, array){
for (i = 0; i < array.length; i++) {
if (word == array[i]) {
return(i);
}
}
return(10000); // could not figure out how to make NaN work...
}
This diff is collapsed.
Click to expand it.
registration/transfer_ProSPr_data/ProSPr_copy_and_mirror.sh
0 → 100644
+
21
−
0
View file @
af3e489f
#!/bin/bash
#SBATCH -o "/g/arendt/EM_6dpf_segmentation/platy-browser-data/registration/transfer_ProSPr_data/copandmir.out"
#SBATCH -e "/g/arendt/EM_6dpf_segmentation/platy-browser-data/registration/transfer_ProSPr_data/copandmir.err"
#SBATCH --mem 16000
#SBATCH -c 4
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -p htc
#SBATCH -t 400
echo
"starting job"
touch
"/g/arendt/EM_6dpf_segmentation/platy-browser-data/registration/transfer_ProSPr_data/copandmir.started"
START_TIME
=
$SECONDS
ulimit
-c
0
hostname
head
-1
/proc/meminfo
module load X11
module load Java
xvfb-run
-a
-e
"/g/arendt/EM_6dpf_segmentation/platy-browser-data/registration/transfer_ProSPr_data/copandmir.err"
/g/almf/software/Fiji.app/ImageJ-linux64
-batch
"/g/arendt/EM_6dpf_segmentation/platy-browser-data/registration/transfer_ProSPr_data/ProSPr_copy_and_mirror.ijm"
ELAPSED_TIME
=
$((
$SECONDS
-
$START_TIME
))
echo
"job finished"
touch
"/g/arendt/EM_6dpf_segmentation/platy-browser-data/registration/transfer_ProSPr_data/copandmir.finished"
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment