Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
d8226c9d
Commit
d8226c9d
authored
11 years ago
by
jakubs
Browse files
Options
Downloads
Patches
Plain Diff
SP-606 CCS-34 improve performance of reading c01 files
SVN: 28993
parent
d49d4275
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
image_readers/source/java/ch/systemsx/cisd/imagereaders/bioformats/BioFormatsImageUtils.java
+54
-2
54 additions, 2 deletions
...sx/cisd/imagereaders/bioformats/BioFormatsImageUtils.java
with
54 additions
and
2 deletions
image_readers/source/java/ch/systemsx/cisd/imagereaders/bioformats/BioFormatsImageUtils.java
+
54
−
2
View file @
d8226c9d
...
...
@@ -32,11 +32,16 @@ import java.util.UUID;
import
loci.common.IRandomAccess
;
import
loci.common.Location
;
import
loci.common.RandomAccessInputStream
;
import
loci.formats.FormatException
;
import
loci.formats.FormatHandler
;
import
loci.formats.IFormatHandler
;
import
loci.formats.IFormatReader
;
import
loci.formats.ImageReader
;
import
loci.formats.MetadataTools
;
import
loci.formats.codec.ZlibCodec
;
import
loci.formats.gui.BufferedImageReader
;
import
loci.formats.in.CellomicsReader
;
import
loci.formats.in.DefaultMetadataOptions
;
import
loci.formats.in.MetadataLevel
;
import
loci.formats.in.MetadataOptions
;
...
...
@@ -55,6 +60,12 @@ final class BioFormatsImageUtils
private
static
final
IFormatReader
[]
READERS
=
new
ImageReader
().
getReaders
();
static
{
MetadataTools
.
setDefaultDateEnabled
(
false
);
CellomicsReader
.
setNoHiddenFiles
(
true
);
}
/**
* Tries to create a suitable reader for the file specified with <var>fileName</var>. This is a
* factory method which returns for each invocation a new instance of a suitable reader. May
...
...
@@ -201,7 +212,7 @@ final class BioFormatsImageUtils
throws
IOExceptionUnchecked
,
IllegalArgumentException
{
String
handleId
=
generateHandleId
(
reader
,
imageID
);
// Add to static map.
Location
.
mapFile
(
handleId
,
handle
);
try
...
...
@@ -286,7 +297,7 @@ final class BioFormatsImageUtils
{
// Add to static map.
String
handleId
=
generateHandleId
(
reader
,
imageID
);
Location
.
mapFile
(
handleId
,
handle
);
try
{
...
...
@@ -326,6 +337,11 @@ final class BioFormatsImageUtils
Location
.
mapFile
(
handleId
,
handle
);
try
{
if
(
reader
instanceof
CellomicsReader
)
{
return
CellomicsReaderUtil
.
readSize
(
handleId
);
}
// This does the actual parsing.
reader
.
setId
(
handleId
);
reader
.
setSeries
(
imageID
.
getSeriesIndex
());
...
...
@@ -346,6 +362,42 @@ final class BioFormatsImageUtils
}
}
public
static
class
CellomicsReaderUtil
{
public
static
Dimension
readSize
(
String
id
)
throws
FormatException
,
IOException
{
RandomAccessInputStream
in
=
getDecompressedStream
(
id
);
in
.
order
(
true
);
in
.
skipBytes
(
4
);
int
x
=
in
.
readInt
();
int
y
=
in
.
readInt
();
in
.
close
();
return
new
Dimension
(
x
,
y
);
}
private
static
RandomAccessInputStream
getDecompressedStream
(
String
filename
)
throws
FormatException
,
IOException
{
RandomAccessInputStream
s
=
new
RandomAccessInputStream
(
filename
);
if
(
FormatHandler
.
checkSuffix
(
filename
,
"c01"
))
{
s
.
seek
(
4
);
ZlibCodec
codec
=
new
ZlibCodec
();
byte
[]
file
=
codec
.
decompress
(
s
,
null
);
s
.
close
();
return
new
RandomAccessInputStream
(
file
);
}
return
s
;
}
}
static
Integer
readImageColorDepth
(
IFormatReader
reader
,
IRandomAccess
handle
,
ImageID
imageID
)
throws
IOExceptionUnchecked
,
IllegalArgumentException
{
...
...
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