Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chenhao Ma
core
Commits
deeb5490
Commit
deeb5490
authored
9 years ago
by
Kevin S. Hahn
Browse files
Options
Downloads
Patches
Plain Diff
starts routes to fetch montage info and get tiles
parent
af74d5ad
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
api.py
+1
-0
1 addition, 0 deletions
api.py
containers.py
+28
-0
28 additions, 0 deletions
containers.py
util.py
+5
-0
5 additions, 0 deletions
util.py
with
34 additions
and
0 deletions
api.py
+
1
−
0
View file @
deeb5490
...
...
@@ -105,6 +105,7 @@ routes = [
webapp2
.
Route
(
r
'
/<:[0-9a-f]{24}>
'
,
acquisitions
.
Acquisition
,
name
=
'
acquisition
'
),
webapp2
.
Route
(
r
'
/<:[0-9a-f]{24}>/file
'
,
acquisitions
.
Acquisition
,
handler_method
=
'
get_file
'
,
methods
=
[
'
GET
'
,
'
POST
'
]),
webapp2
.
Route
(
r
'
/<:[0-9a-f]{24}>/file
'
,
acquisitions
.
Acquisition
,
handler_method
=
'
put_file
'
,
methods
=
[
'
PUT
'
]),
webapp2
.
Route
(
r
'
/<:[0-9a-f]{24}>/tile
'
,
acquisitions
.
Acquisition
,
handler_method
=
'
get_tile
'
,
methods
=
[
'
GET
'
]),
webapp2
.
Route
(
r
'
/<:[0-9a-f]{24}>/attachment
'
,
acquisitions
.
Acquisition
,
handler_method
=
'
delete_attachment
'
,
methods
=
[
'
DELETE
'
]),
webapp2
.
Route
(
r
'
/<:[0-9a-f]{24}>/attachment
'
,
acquisitions
.
Acquisition
,
handler_method
=
'
get_attachment
'
,
methods
=
[
'
GET
'
,
'
POST
'
]),
webapp2
.
Route
(
r
'
/<:[0-9a-f]{24}>/attachment
'
,
acquisitions
.
Acquisition
,
handler_method
=
'
put_attachment
'
,
methods
=
[
'
PUT
'
]),
...
...
This diff is collapsed.
Click to expand it.
containers.py
+
28
−
0
View file @
deeb5490
...
...
@@ -325,6 +325,34 @@ class Container(base.RequestHandler):
else
:
self
.
abort
(
400
,
'
%s is not listed in the sha1s
'
%
fname
)
def
get_tile
(
self
,
cid
):
"""
fetch info about a tiled tiff, or retrieve a specific tile.
"""
_id
=
bson
.
ObjectId
(
cid
)
montage_info
=
self
.
dbc
.
find_one
(
{
'
_id
'
:
_id
,
'
$and
'
:
[
{
'
files.kinds
'
:
[
'
montage
'
]},
{
'
files.ext
'
:
'
.tiff
'
},
],
},
[
'
files.$
'
],
)
if
not
montage_info
:
self
.
abort
(
404
,
'
montage tiff not found
'
)
fn
=
montage_info
[
'
files
'
][
0
][
'
name
'
]
+
montage_info
[
'
files
'
][
0
][
'
ext
'
]
fp
=
os
.
path
.
join
(
self
.
app
.
config
[
'
data_path
'
],
cid
[
-
3
:],
cid
,
fn
)
z
=
self
.
request
.
get
(
'
z
'
)
x
=
self
.
request
.
get
(
'
x
'
)
y
=
self
.
request
.
get
(
'
y
'
)
if
not
(
z
and
x
and
y
):
return
util
.
get_info
(
fp
)
else
:
self
.
response
.
content_type
=
'
image/png
'
tile
=
util
.
get_tile
(
fp
,
int
(
z
),
int
(
x
),
int
(
y
))
if
tile
:
self
.
response
.
write
(
tile
)
def
get_attachment
(
self
,
cid
):
"""
Download one attachment.
"""
fname
=
self
.
request
.
get
(
'
name
'
)
...
...
This diff is collapsed.
Click to expand it.
util.py
+
5
−
0
View file @
deeb5490
...
...
@@ -12,6 +12,11 @@ import datetime
import
tempdir
as
tempfile
import
scitran.data
import
scitran.data.medimg.montage
get_info
=
scitran
.
data
.
medimg
.
montage
.
get_info
get_tile
=
scitran
.
data
.
medimg
.
montage
.
get_tile
PROJECTION_FIELDS
=
[
'
timestamp
'
,
'
permissions
'
,
'
public
'
]
...
...
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