Skip to content

Commit 2b9fa35

Browse files
committed
merging in alleninstitute
2 parents 9ccb66b + c9b4ce2 commit 2b9fa35

35 files changed

+2184
-291
lines changed

CONTRIBUTING.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Allen Institute Contribution Agreement
2+
3+
This document describes the terms under which you may make “Contributions” —
4+
which may include without limitation, software additions, revisions, bug fixes, configuration changes,
5+
documentation, or any other materials — to any of the projects owned or managed by the Allen Institute.
6+
If you have questions about these terms, please contact us at [email protected].
7+
8+
You certify that:
9+
10+
• Your Contributions are either:
11+
12+
1. Created in whole or in part by you and you have the right to submit them under the designated license
13+
(described below); or
14+
2. Based upon previous work that, to the best of your knowledge, is covered under an appropriate
15+
open source license and you have the right under that license to submit that work with modifications,
16+
whether created in whole or in part by you, under the designated license; or
17+
18+
3. Provided directly to you by some other person who certified (1) or (2) and you have not modified them.
19+
20+
• You are granting your Contributions to the Allen Institute under the terms of the [2-Clause BSD license](https://opensource.org/licenses/BSD-2-Clause)
21+
(the “designated license”).
22+
23+
• You understand and agree that the Allen Institute projects and your Contributions are public and that
24+
a record of the Contributions (including all metadata and personal information you submit with them) is
25+
maintained indefinitely and may be redistributed consistent with the Allen Institute’s mission and the
26+
2-Clause BSD license.

Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ RUN pip install setuptools --upgrade --disable-pip-version-check
88
RUN pip install argschema --upgrade --disable-pip-version-check
99
RUN pip install jupyter
1010
RUN apt-get install libspatialindex-dev -y
11+
RUN conda install nomkl
1112
COPY . /usr/local/render-python-apps
1213

1314
#RUN git clone https://github.com/fcollman/render-python-apps

allen_utils/docker_setup.sh

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
docker pull atbigdawg:5000/fcollman/render-python:latest
2-
docker tag atbigdawg:5000/fcollman/render-python:latest fcollman/render-python:latest
1+
#docker pull atbigdawg:5000/fcollman/render-python:latest
2+
#docker tag atbigdawg:5000/fcollman/render-python:latest fcollman/render-python:latest
33
docker build -t fcollman/render-python-apps .
44
docker tag fcollman/render-python-apps atbigdawg:5000/fcollman/render-python-apps
55
docker push atbigdawg:5000/fcollman/render-python-apps
@@ -10,14 +10,11 @@ docker run -t --name renderapps \
1010
-v /nas2:/nas2 \
1111
-v /nas3:/nas3 \
1212
-v /nas4:/nas4 \
13+
-v /nas5:/nas5 \
1314
-v /data:/data \
1415
-v /pipeline:/pipeline \
1516
-v /pipeline/render-python-apps:/usr/local/render-python-apps \
1617
-v /etc/hosts:/etc/hosts \
17-
--dns 10.128.104.10 \
18-
-p 8888:8888 \
18+
-p 7777:7777 \
1919
-e "PASSWORD=$JUPYTERPASSWORD" \
20-
-i -t fcollman/render-python-apps \
21-
/bin/bash -c "/opt/conda/bin/jupyter notebook --config=/root/.jupyter/jupyter_notebook_config.py --notebook-dir=/pipeline/render-python-apps --no-browser --allow-root"
22-
23-
20+
-i -t fcollman/render-python-apps

allen_utils/reorg_setup.sh

+12-13
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
docker pull atbigdawg:5000/fcollman/render-python:master
2-
docker tag atbigdawg:5000/fcollman/render-python:master fcollman/render-python
3-
docker build -t fcollman/render-python-apps:reorg .
4-
docker tag fcollman/render-python-apps:reorg fcollman/render-python-apps:reorg_testsharmi
5-
docker push atbigdawg:5000/fcollman/render-python-apps
6-
docker kill renderapps_testsharmi
7-
docker rm renderapps_testsharmi
8-
docker run -d --name renderapps_testsharmi \
1+
docker pull localhost:5000/fcollman/render-python:master
2+
docker tag localhost:5000/fcollman/render-python:master fcollman/render-python
3+
docker build -t sharmi/render-python-apps:reorg .
4+
#docker tag fcollman/render-python-apps:reorg fcollman/render-python-apps:reorg_testsharmi
5+
#docker push atbigdawg:5000/fcollman/render-python-apps
6+
docker kill renderapps_develop
7+
docker rm renderapps_develop
8+
docker run -d --name renderapps_develop \
99
-v /nas2:/nas2 \
1010
-v /nas:/nas \
1111
-v /nas3:/nas3 \
1212
-v /nas4:/nas4 \
1313
-v /data:/data \
1414
-v /pipeline:/pipeline \
15-
-v /pipeline/sharmi/Sharmi_tools/render-python-apps:/usr/local/render-python-apps \
15+
-v /pipeline/sharmi/Sharmi_tools/render-python-apps-branches/DEVELOP/render-python-apps:/usr/local/share/render-python-apps \
1616
-v /etc/hosts:/etc/hosts \
17-
-p 9999:9999 \
17+
-p 7777:7777 \
1818
-e "PASSWORD=$JUPYTERPASSWORD" \
19-
-i -t fcollman/render-python-apps:reorg_testsharmi
20-
21-
19+
-i -t sharmi/render-python-apps:reorg \
20+
/bin/bash -c "jupyter notebook --config=/root/.jupyter/jupyter_notebook_config.py --no-browser --allow-root --notebook-dir=/pipeline/sharmi/Sharmi_tools/render-python-apps-branches/DEVELOP/render-python-apps"

jupyter_notebook_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from IPython.lib import passwd
1717

1818
c.NotebookApp.ip = '*'
19-
c.NotebookApp.port = 8888
19+
c.NotebookApp.port = 7777
2020
c.NotebookApp.open_browser = False
2121
c.MultiKernelManager.default_kernel_name = 'python2'
2222

renderapps/TrakEM2/ImportTrakEM2Annotations.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,14 @@ def run(self):
174174
pot_render_tilespecs = self.render.run(renderapi.tilespec.get_tile_specs_from_z,
175175
self.args['EMstack'],
176176
ts.z)
177-
mml=ts.ip.get(0,None)
178-
if mml is None:
179-
mml = ts.channels[0].ip[0]
177+
try:
178+
mml=ts.ip.get(0)
179+
except KeyError:
180+
mml = ts.channels[0].ip.get(0)
180181

181182

182-
filepath = (os.path.split(mml.imageUrl)[1]).split('_flip')[0]
183-
pot_filepaths = [(os.path.split(t.ip[0].imageUrl)[1]).split(
183+
filepath = (os.path.split(mml['imageUrl'])[1]).split('_flip')[0]
184+
pot_filepaths = [(os.path.split(t.ip.get(0)['imageUrl'])[1]).split(
184185
'_flip')[0] for t in pot_render_tilespecs]
185186
render_tilespecs.append(next(t for t, fp in zip(
186187
pot_render_tilespecs, pot_filepaths) if fp == filepath))

renderapps/TrakEM2/MakeSynaptogramsFromAnnotation_OidList.py

+17-41
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
############## this is modified from notebook: http://ibs-forrestc-ux1:8888/notebooks/MakeSynaptogramsFromAnnotations.ipynb #####
1818

1919

20-
example_parameters =
21-
{
20+
example_parameters = {
2221
"render":{
2322
"host": "ibs-forrestc-ux1",
2423
"port": 80,
@@ -27,51 +26,27 @@
2726
"client_scripts": "/pipeline/render/render-ws-java-client/src/main/scripts"
2827
},
2928

30-
"global_annotation_file":"/nas3/data/M247514_Rorb_1/annotation/m247514_Take2Site4Annotation_MN_Take2Site4global.json",
31-
"annotation_metadata_json":"/nas3/data/M247514_Rorb_1/annotation/junk3.json",
32-
"fig_directory":"/nas3/data/M247514_Rorb_1/processed/Take2Site4Missing",
33-
"synapses_to_make":['1126',
34-
'1276',
35-
'1302',
36-
'1352',
37-
'1380',
38-
'1386',
39-
'1490',
40-
'1510',
41-
'1554',
42-
'2693',
43-
'2695',
44-
'2697',
45-
'2699',
46-
'2701',
47-
'2703',
48-
'2705',
49-
'2707'],
29+
"global_annotation_file":"/nas/data/M246930_Scnn1a_4_f1/annotation/m246930_site5_annotation_MN_adjustZ_bb_Take2Site5_EMA_global.json",
30+
"annotation_metadata_json":"/nas/data/M246930_Scnn1a_4_f1/SEMdata/processed/Synaptograms/annotationMetadata/m246930_Take2Site5_synaptogram_metadata.json",
31+
"fig_directory":"/nas/data/M246930_Scnn1a_4_f1/SEMdata/processed/Synaptograms/Take2Site5_TdTeSyn",
32+
"synapses_to_make":['1226','1326','1416','2171','2299','668','2707','2709','2711'],
5033
"channel_stacks":[
5134
{
52-
"stack":"Take2Site4Align_EMclahe"
35+
36+
"stack":"EMSite5_take2_EMA"
5337
},
5438
{
55-
"stack":"Take2Site4Align_EMclahe"
39+
40+
"stack":"EMSite5_take2_EMA"
5641
},
5742
{
5843
"channel":"TdTomato",
59-
"stack":"Take2Site4Align_Session2",
60-
"maxIntensity":25000
61-
},
62-
{
63-
"channel":"PSD95",
64-
"stack":"Take2Site4Align_Session1",
44+
"stack":"Take2Site5_EMA_STI_DCV_FF_allSession_2",
6545
"maxIntensity":10000
6646
},
67-
{
68-
"channel":"GABA",
69-
"stack":"Take2Site4Align_Session3",
70-
"maxIntensity":5000
71-
},
7247
{
7348
"channel":"synapsin",
74-
"stack":"Take2Site4Align_Session3",
49+
"stack":"Take2Site5_manReg_EMA_STI_DCV_FF_allSession_3",
7550
"maxIntensity":16000
7651
}
7752
]
@@ -104,15 +79,14 @@ class MakeAnnotationSynaptogramParameters(RenderParameters):
10479

10580

10681

107-
def load_annotation_file(annotation_path):
82+
def load_annotation_file(annotation_path):
10883
with open(annotation_path,'r') as fp:
10984
annotation_d = json.load(fp)
11085
schema = AnnotationFile()
11186
annotations,errors = schema.load(annotation_d)
11287
assert(len(errors)==0)
11388
return annotations
11489

115-
11690
def make_synaptogram(render,channel_stacks,savedir,al,border=400/3,borderz=2):
11791
oid = al['oid']
11892
zvalues = []
@@ -162,7 +136,8 @@ def make_synaptogram(render,channel_stacks,savedir,al,border=400/3,borderz=2):
162136
plt.rcParams['axes.facecolor'] = 'black'
163137
f,ax=plt.subplots(Nc,Nz,
164138
figsize=(fig_width,int(fig_width*ratio)),
165-
gridspec_kw = {'wspace':0, 'hspace':0})
139+
gridspec_kw = {'wspace':0, 'hspace':0},
140+
facecolor='black')
166141
plt.subplots_adjust(left=0.0, right=1.0, top=1.0, bottom=0.0)
167142
for c,chstack in enumerate(channel_stacks):
168143
for zi,z in enumerate(zvals):
@@ -188,11 +163,11 @@ def make_synaptogram(render,channel_stacks,savedir,al,border=400/3,borderz=2):
188163
zi = int(area['z']-minZ)
189164
for c in range(1,len(channel_stacks)):
190165
a = ax[c,zi]
191-
a.plot(area['global_path'][:,0],area['global_path'][:,1],c='g',linewidth=3)
166+
a.plot(area['global_path'][:,0],area['global_path'][:,1],c='Teal',linewidth=2)
192167
for c,chstack in enumerate(channel_stacks):
193168
chname = chstack.get('channel',chstack['stack'])
194169

195-
ax[c,0].text(minX,minY,chname,fontdict={'color':'w','weight':'bold'},fontsize=16)
170+
ax[c,0].text(minX,minY,chname[0:4],fontdict={'color':'SLATEGRAY','weight':'bold'},fontsize=14)
196171
#f.tight_layout(True)
197172
fname = os.path.join(savedir,'{}.png'.format(oid))
198173
f.savefig(fname)
@@ -202,6 +177,7 @@ def make_synaptogram(render,channel_stacks,savedir,al,border=400/3,borderz=2):
202177
del(f)
203178
return d
204179

180+
205181
class MakeAnnotationSynaptograms(RenderModule):
206182
default_schema = MakeAnnotationSynaptogramParameters
207183

renderapps/TrakEM2/transform_local_annotation_json_to_global.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
example_input={
1313
"render":{
1414
"host":"ibs-forrestc-ux1",
15-
"port":8080,
15+
"port":80,
1616
"owner":"Forrest",
17-
"project":"M247514_Rorb_1",
17+
"project":"M246930_Scnn1a_4_f1",
1818
"client_scripts":"/pipeline/render/render-ws-java-client/src/main/scripts"
1919
},
20-
"stack":"Take2Site4Align_EMclahe",
21-
"input_annotation_file":"/nas3/data/M247514_Rorb_1/annotation/m247514_Take2Site4Annotation_MN_bb_local.json",
22-
"output_annotation_file":"/nas3/data/M247514_Rorb_1/annotation/m247514_Take2Site4Annotation_MN_bb_Take2Site4Align_EMclahe_global.json"
20+
"stack":"EMSite5_take2_EMA",
21+
"input_annotation_file":"/nas3/data/M246930_Scnn1a_4_f1/annotation/m246930_site5_annotation_MN_adjustZ_bb_local.json",
22+
"output_annotation_file":"/nas3/data/M246930_Scnn1a_4_f1/annotation/m246930_site5_annotation_MN_adjustZ_bb_EMSite5_take2_EMA_global.json"
2323
}
2424

2525

renderapps/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
from . import wrinkle_detection
1616
from . import rough_align
1717
from . import synapse_detection
18+
from . import intensity_correction
1819

1920
__all__ = ['cross_modal_registration', 'dataimport', 'materialize', 'pointmatch',
2021
'module','shapely',
2122
'registration', 'section_polygons', 'stack',
22-
'stitching', 'tile', 'TrakEM2','transfer','wrinkle_detection','datamanagement','rough_align','synapse_detection']
23+
'stitching', 'tile', 'TrakEM2','transfer','wrinkle_detection','datamanagement','rough_align','synapse_detection','intensity_correction']

renderapps/cross_modal_registration/import_EM_registration_projects_multi.py

+22-9
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
example_json = {
1919
"render":{
2020
"host":"ibs-forrestc-ux1",
21-
"port":8080,
21+
"port":8988,
2222
"owner":"Forrest",
23-
"project":"M247514_Rorb_1",
23+
"project":"M246930_Scnn1a_4_f1",
2424
"client_scripts":"/pipeline/render/render-ws-java-client/src/main/scripts"
2525
},
26-
"inputStack":"EM_Site4_stitched_SHIFT",
27-
"LMstacks":["BIGREG_MARCH_21_MBP_deconvnew"],
28-
"outputStack":"BIGREG_EM_Site4_stitched",
26+
"inputStack":"REG_STI_FF_S03_DAPI_3",
27+
"LMstacks":["Stitched_1_DAPI_1"],
28+
"outputStack":"REG01_STI_FF_S03_DAPI_3",
2929
"renderHome":"/var/www/render",
30-
"outputXMLdir":"/nas3/data/M247514_Rorb_1/processed/EMLMRegProjects_Site4/"
30+
"outputXMLdir":"/nas/data/M246930_Scnn1a_4_f1/processed/tilepairfiles/TrackEM_projects/"
3131
}
3232
class ImportEMRegistrationMultiProjects(TrakEM2RenderModule):
3333
def __init__(self,schema_type=None,*args,**kwargs):
@@ -47,14 +47,27 @@ def run(self):
4747
EMz = renderapi.stack.get_z_values_for_stack(self.args['inputStack'],render=self.render)
4848

4949
tilespecsfiles = []
50-
shiftTransform = AffineModel(B0=self.args['minX'],B1=self.args['minY'])
50+
51+
buffersize = self.args['buffersize']
52+
self.args['minX'] = self.args['minX'] - buffersize
53+
self.args['minY'] = self.args['minY'] - buffersize
54+
self.args['maxX'] = self.args['maxX'] + buffersize
55+
self.args['maxY'] = self.args['maxY'] + buffersize
56+
#width = self.args['maxX']-self.args['minX']
57+
#height = self.args['maxY']-self.args['minY']
58+
59+
print("This is buffersize: %d "%buffersize)
60+
61+
shiftTransform = AffineModel(B0=self.args['minX'] ,B1=self.args['minY'] )
62+
63+
5164

5265
for z in EMz:
5366
infile = os.path.join(xmlDir,'%05d.xml'%z)
5467
outfile = os.path.join(xmlDir,'%05d.json'%z)
5568
newoutfile = os.path.join(xmlDir,'%05d-new.json'%z)
5669
self.convert_trakem2_project(infile,xmlDir,outfile)
57-
70+
5871
newtilejson = json.load(open(outfile,'r'))
5972
newEMtilespecs = [TileSpec(json=tsj) for tsj in newtilejson]
6073
EMtilespecs = renderapi.tilespec.get_tile_specs_from_minmax_box(
@@ -81,4 +94,4 @@ def run(self):
8194

8295
if __name__ == "__main__":
8396
mod = ImportEMRegistrationMultiProjects(input_data= example_json)
84-
mod.run()
97+
mod.run()

renderapps/cross_modal_registration/import_LM_subset_from_EM_registration_multi.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
if __name__ == "__main__" and __package__ is None:
2+
__package__ = "renderapps.cross_modal_registration.import_LM_subset_from_EM_registration_multi"
3+
14
import renderapi
25
from ..TrakEM2.trakem2utils import \
36
createchunks, createheader, createproject, \

renderapps/cross_modal_registration/make_EM_LM_registration_projects.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def run(self):
8686
mod.args['minY'],
8787
mod.args['maxY'],
8888
render=mod.render)
89-
createlayer_fromtilespecs(LMtilespecs, outfile,1,shiftx=-mod.args['minX'],shifty=-mod.args['minY'],affineOnly=False)
89+
createlayer_fromtilespecs(LMtilespecs, outfile,1,shiftx=-mod.args['minX'],shifty=-mod.args['minY'],affineOnly=True)
9090
createfooters(outfile)
9191
print(self.args)
9292

0 commit comments

Comments
 (0)