Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QcmpCompressionLibrary
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BioinformaticDataCompression
QcmpCompressionLibrary
Commits
9b3f65ea
Commit
9b3f65ea
authored
5 years ago
by
Vojtěch Moravec
Browse files
Options
Downloads
Patches
Plain Diff
Basic loading in ImageJBufferLoader.
parent
9a423f4f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/azgracompress/io/InputData.java
+0
-3
0 additions, 3 deletions
src/main/java/azgracompress/io/InputData.java
src/main/java/azgracompress/io/loader/ImageJBufferLoader.java
+54
-0
54 additions, 0 deletions
...main/java/azgracompress/io/loader/ImageJBufferLoader.java
with
54 additions
and
3 deletions
src/main/java/azgracompress/io/InputData.java
+
0
−
3
View file @
9b3f65ea
...
...
@@ -94,9 +94,6 @@ public abstract class InputData {
this
.
pixelType
=
pixelType
;
}
public
V3i
getDimension
()
{
return
dimension
;
}
/**
* Override in FileInputData!!!
...
...
This diff is collapsed.
Click to expand it.
src/main/java/azgracompress/io/loader/ImageJBufferLoader.java
0 → 100644
+
54
−
0
View file @
9b3f65ea
package
azgracompress.io.loader
;
import
azgracompress.data.ImageU16
;
import
azgracompress.io.BufferInputData
;
import
azgracompress.io.InputData
;
import
azgracompress.utilities.TypeConverter
;
import
java.awt.*
;
import
java.io.IOException
;
import
java.rmi.server.ExportException
;
import
java.util.Arrays
;
public
class
ImageJBufferLoader
implements
IPlaneLoader
{
private
final
BufferInputData
bufferInputData
;
public
ImageJBufferLoader
(
BufferInputData
bufferDataInfo
)
{
this
.
bufferInputData
=
bufferDataInfo
;
assert
(
this
.
bufferInputData
.
getPixelType
()
==
InputData
.
PixelType
.
Gray16
);
}
private
int
[]
copyShortArray
(
short
[]
srcArray
,
int
srcOffset
,
int
copyLen
)
{
int
[]
destArray
=
new
int
[
copyLen
];
for
(
int
i
=
0
;
i
<
copyLen
;
i
++)
{
destArray
[
i
]
=
TypeConverter
.
shortToInt
(
srcArray
[
srcOffset
+
i
]);
}
return
destArray
;
}
@Override
public
ImageU16
loadPlaneU16
(
int
plane
)
throws
IOException
{
switch
(
bufferInputData
.
getPixelType
())
{
case
Gray16:
{
final
int
planePixelCount
=
bufferInputData
.
getDimensions
().
getX
()
*
bufferInputData
.
getDimensions
().
getY
();
final
int
offset
=
plane
*
planePixelCount
;
final
short
[]
srcBuffer
=
(
short
[])
bufferInputData
.
getBuffer
();
return
new
ImageU16
(
bufferInputData
.
getDimensions
().
getX
(),
bufferInputData
.
getDimensions
().
getY
(),
copyShortArray
(
srcBuffer
,
offset
,
planePixelCount
));
}
default
:
throw
new
IOException
(
"Unable to load unsupported pixel type."
);
}
}
@Override
public
int
[]
loadPlanesU16Data
(
int
[]
planes
)
throws
IOException
{
return
new
int
[
0
];
}
@Override
public
int
[]
loadAllPlanesU16Data
()
throws
IOException
{
return
new
int
[
0
];
}
}
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