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
9adcedbd
Commit
9adcedbd
authored
4 years ago
by
Vojtech Moravec
Browse files
Options
Downloads
Patches
Plain Diff
Fix loading of single plane in middle plane codebook training.
parent
d65bb181
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/cz/it4i/qcmp/compression/SQImageCompressor.java
+16
-20
16 additions, 20 deletions
...main/java/cz/it4i/qcmp/compression/SQImageCompressor.java
with
16 additions
and
20 deletions
src/main/java/cz/it4i/qcmp/compression/SQImageCompressor.java
+
16
−
20
View file @
9adcedbd
...
@@ -181,7 +181,7 @@ public class SQImageCompressor extends CompressorDecompressorBase implements IIm
...
@@ -181,7 +181,7 @@ public class SQImageCompressor extends CompressorDecompressorBase implements IIm
return
planeDataSizes
;
return
planeDataSizes
;
}
}
private
int
[]
loadConfiguredPlanesData
()
throws
ImageCompressionException
{
private
int
[]
loadConfiguredPlanesData
()
throws
ImageCompressionException
,
IOException
{
final
InputData
inputDataInfo
=
options
.
getInputDataInfo
();
final
InputData
inputDataInfo
=
options
.
getInputDataInfo
();
final
IPlaneLoader
planeLoader
;
final
IPlaneLoader
planeLoader
;
try
{
try
{
...
@@ -191,36 +191,32 @@ public class SQImageCompressor extends CompressorDecompressorBase implements IIm
...
@@ -191,36 +191,32 @@ public class SQImageCompressor extends CompressorDecompressorBase implements IIm
}
}
int
[]
trainData
=
null
;
int
[]
trainData
=
null
;
if
(
inputDataInfo
.
isPlaneIndexSet
()
)
{
if
(
options
.
getCodebookType
()
==
CompressionOptions
.
CodebookType
.
MiddlePlane
)
{
try
{
final
int
middlePlaneIndex
=
inputDataInfo
.
getDimensions
().
getZ
()
/
2
;
reportStatusToListeners
(
"Loading single plane data."
);
reportStatusToListeners
(
"Loading single plane data."
);
trainData
=
planeLoader
.
loadPlaneData
(
inputDataInfo
.
get
PlaneIndex
()
);
trainData
=
planeLoader
.
loadPlaneData
(
middle
PlaneIndex
);
}
catch
(
f
in
al
IOException
e
)
{
}
else
if
(
in
putDataInfo
.
isPlaneIndexSet
()
)
{
throw
new
ImageCompressionException
(
"Failed to load
plane data."
,
e
);
reportStatusToListeners
(
"Loading single
plane data."
);
}
trainData
=
planeLoader
.
loadPlaneData
(
inputDataInfo
.
getPlaneIndex
());
}
else
if
(
inputDataInfo
.
isPlaneRangeSet
())
{
}
else
if
(
inputDataInfo
.
isPlaneRangeSet
())
{
reportStatusToListeners
(
"Loading plane range data."
);
reportStatusToListeners
(
"Loading plane range data."
);
final
int
[]
planes
=
getPlaneIndicesForCompression
(
options
.
getInputDataInfo
());
final
int
[]
planes
=
getPlaneIndicesForCompression
(
options
.
getInputDataInfo
());
try
{
trainData
=
planeLoader
.
loadPlanesU16Data
(
planes
);
trainData
=
planeLoader
.
loadPlanesU16Data
(
planes
);
}
catch
(
final
IOException
e
)
{
e
.
printStackTrace
();
throw
new
ImageCompressionException
(
"Failed to load plane range data."
,
e
);
}
}
else
{
}
else
{
reportStatusToListeners
(
"Loading all planes data."
);
reportStatusToListeners
(
"Loading all planes data."
);
try
{
trainData
=
planeLoader
.
loadAllPlanesU16Data
();
trainData
=
planeLoader
.
loadAllPlanesU16Data
();
}
catch
(
final
IOException
e
)
{
throw
new
ImageCompressionException
(
"Failed to load all planes data."
,
e
);
}
}
}
return
trainData
;
return
trainData
;
}
}
@Override
@Override
public
void
trainAndSaveCodebook
()
throws
ImageCompressionException
{
public
void
trainAndSaveCodebook
()
throws
ImageCompressionException
{
final
int
[]
trainData
=
loadConfiguredPlanesData
();
final
int
[]
trainData
;
try
{
trainData
=
loadConfiguredPlanesData
();
}
catch
(
final
IOException
e
)
{
throw
new
ImageCompressionException
(
"Failed to load configured plane data in SQImageCompressor."
);
}
final
LloydMaxU16ScalarQuantization
lloydMax
=
new
LloydMaxU16ScalarQuantization
(
trainData
,
final
LloydMaxU16ScalarQuantization
lloydMax
=
new
LloydMaxU16ScalarQuantization
(
trainData
,
getCodebookSize
(),
getCodebookSize
(),
...
...
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