Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
MAINT: Rearrange files to comply with http://arxiv.org/abs/1609.00037
- Loading branch information
Showing
10 changed files
with
90 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Behavior: empty values are considered false | ||
controls_only = yes | ||
|
||
# Paths | ||
PREFIX_OUTPUT = 2017-02-20 | ||
PREFIX_SRC = ../../src | ||
IMAGES = ../z_projection | ||
PIPELINE = $(PREFIX_SRC)/image-processing-pipeline.cpproj | ||
FILELIST = $(PREFIX_OUTPUT)/filelist | ||
|
||
# Executables | ||
cellprofiler = cellprofiler | ||
|
||
.PHONY: cellprofiler | ||
cellprofiler : $(FILELIST) | ||
$(cellprofiler) \ | ||
--pipeline=$(PIPELINE) \ | ||
--output-directory=$(PREFIX_OUTPUT) \ | ||
--file-list=$(FILELIST) | ||
|
||
.PHONY : filelist | ||
filelist : $(FILELIST) | ||
$(FILELIST) : $(IMAGES) | ||
ifneq ($(CLUSTER),) | ||
find $< -type f | sort > $@ | ||
else | ||
#find $< -type f -regex '^502[^_]_(J18|I09|H09|N22|E20|M13|K11)' | sort > $@ | ||
find $< -type f -regex '.*/502[^_]+_J18_S08.*' | sort > $@ | ||
endif |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
""" | ||
Reduce image Z-stack to maximum intensity projection. | ||
""" | ||
# pylint: disable=invalid-name,superfluous-parens | ||
|
||
import glob | ||
import multiprocessing as mp | ||
import os | ||
|
||
import numpy as np | ||
import scipy.misc | ||
|
||
|
||
out_dir = "../results/z_projection" | ||
z_slices = 3 | ||
# Assume all files are tif, and therefore that the number of files is | ||
# a multiple of z_slices. | ||
print("Reading file list") | ||
all_files = glob.glob('../data/April_14_2016/*/*') | ||
all_files.sort() | ||
|
||
if not os.path.exists(out_dir): | ||
print("Creating output directory") | ||
os.mkdir(out_dir) | ||
|
||
print("Creating output file list") | ||
all_files_out = [ | ||
os.path.join(out_dir, | ||
os.path.basename(all_files[i].replace("_Z1", ""))) | ||
for i in xrange(0, len(all_files), z_slices) | ||
] | ||
|
||
def max_projection(pool_index): | ||
""" | ||
Create and save image maximum intensity projection. | ||
""" | ||
offset = pool_index * z_slices | ||
im1 = scipy.misc.imread(all_files[offset]) | ||
shape = [1] + list(im1.shape) | ||
for file_ in all_files[offset + 1:offset + z_slices]: | ||
im2 = scipy.misc.imread(file_) | ||
im_stack = np.concatenate((im1.reshape(shape), | ||
im2.reshape(shape)), axis=0) | ||
im1 = im_stack.max(axis=0) | ||
scipy.misc.imsave(all_files_out[pool_index], im1) | ||
|
||
print("Reading images, merging and saving (this can take a while)") | ||
pool = mp.Pool() | ||
pool.map(max_projection, xrange(len(all_files_out))) | ||
|
||
print("Finished") |
File renamed without changes.
File renamed without changes.
File renamed without changes.