Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tensorflow 1 Interface
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bioimage Analysis
Tensorflow 1 Interface
Commits
a25de514
Commit
a25de514
authored
2 years ago
by
carlosuc3m
Browse files
Options
Downloads
Patches
Plain Diff
keep correcting small errors
parent
8263cc73
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/bioimageanalysis/icy/deeplearning/tensorflow/v1/tensor/MappedBufferToImgLib2.java
+14
-11
14 additions, 11 deletions
...plearning/tensorflow/v1/tensor/MappedBufferToImgLib2.java
with
14 additions
and
11 deletions
src/main/java/org/bioimageanalysis/icy/deeplearning/tensorflow/v1/tensor/MappedBufferToImgLib2.java
+
14
−
11
View file @
a25de514
...
@@ -32,9 +32,10 @@ public final class MappedBufferToImgLib2
...
@@ -32,9 +32,10 @@ public final class MappedBufferToImgLib2
* Pattern that matches the header of the temporal file for interprocess communication
* Pattern that matches the header of the temporal file for interprocess communication
* and retrieves data type and shape
* and retrieves data type and shape
*/
*/
private
static
final
Pattern
HEADER_PATTERN
=
private
static
final
Pattern
HEADER_PATTERN
=
Pattern
.
compile
(
"'dtype':'([a-zA-Z0-9]+)'"
Pattern
.
compile
(
"\\{'dtype':'([a-zA-Z0-9]+)','axes':'([a-zA-Z0-9]+)'"
+
",'axes':'([a-zA-Z]+)'"
+
",'name':'(.+?)',shape':'\\[(\\d+(,\\d+)*)\\]'}"
);
+
",'name':'([^']*)'"
+
",'shape':'(\\[\\s*(?:(?:[1-9]\\d*|0)\\s*,\\s*)*(?:[1-9]\\d*|0)?\\s*\\])'"
);
/**
/**
* Key for data type info
* Key for data type info
*/
*/
...
@@ -248,17 +249,19 @@ public final class MappedBufferToImgLib2
...
@@ -248,17 +249,19 @@ public final class MappedBufferToImgLib2
* @return
* @return
*/
*/
public
static
HashMap
<
String
,
Object
>
getDataTypeAndShape
(
String
infoStr
)
{
public
static
HashMap
<
String
,
Object
>
getDataTypeAndShape
(
String
infoStr
)
{
Matcher
m
=
HEADER_PATTERN
.
matcher
(
infoStr
);
Matcher
m
atcher
=
HEADER_PATTERN
.
matcher
(
infoStr
);
if
(!
m
.
find
())
{
if
(!
m
atcher
.
find
())
{
throw
new
IllegalArgumentException
(
"Cannot find datatype and dimensions "
throw
new
IllegalArgumentException
(
"Cannot find datatype
, name, axes
and dimensions "
+
"info in file hader: "
+
infoStr
);
+
"info in file h
e
ader: "
+
infoStr
);
}
}
String
typeStr
=
m
.
group
(
1
);
String
typeStr
=
matcher
.
group
(
1
);
String
axesStr
=
m
.
group
(
2
);
String
axesStr
=
matcher
.
group
(
2
);
String
nameStr
=
m
.
group
(
3
);
String
nameStr
=
matcher
.
group
(
3
);
String
shapeStr
=
m
.
group
(
4
);
String
shapeStr
=
matcher
.
group
(
4
);
long
[]
shape
=
new
long
[
0
];
long
[]
shape
=
new
long
[
0
];
if
(!
shapeStr
.
isEmpty
()
&&
!
shapeStr
.
equals
(
"[]"
))
{
if
(!
shapeStr
.
isEmpty
()
&&
!
shapeStr
.
equals
(
"[]"
))
{
shapeStr
=
shapeStr
.
substring
(
0
,
shapeStr
.
length
()
-
1
);
String
[]
tokens
=
shapeStr
.
split
(
", ?"
);
String
[]
tokens
=
shapeStr
.
split
(
", ?"
);
shape
=
Arrays
.
stream
(
tokens
).
mapToLong
(
Long:
:
parseLong
).
toArray
();
shape
=
Arrays
.
stream
(
tokens
).
mapToLong
(
Long:
:
parseLong
).
toArray
();
}
}
...
...
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