Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
tomwer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
tomotools
tomwer
Commits
aec79e40
Commit
aec79e40
authored
4 months ago
by
payno
Browse files
Options
Downloads
Patches
Plain Diff
drac: save_to_gallery: include 'max_value' parameter to take into account all images value.
parent
09331daa
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/tomwer/core/process/drac/dracbase.py
+7
-2
7 additions, 2 deletions
src/tomwer/core/process/drac/dracbase.py
src/tomwer/core/process/drac/processeddataset.py
+2
-0
2 additions, 0 deletions
src/tomwer/core/process/drac/processeddataset.py
with
9 additions
and
2 deletions
src/tomwer/core/process/drac/dracbase.py
+
7
−
2
View file @
aec79e40
...
@@ -123,7 +123,10 @@ class DracDatasetBase:
...
@@ -123,7 +123,10 @@ class DracDatasetBase:
}
}
def
save_to_gallery
(
def
save_to_gallery
(
self
,
output_file_name
:
str
,
image
:
numpy
.
ndarray
|
DataUrl
self
,
output_file_name
:
str
,
image
:
numpy
.
ndarray
|
DataUrl
,
max_value
:
int
|
None
=
None
,
)
->
None
:
)
->
None
:
format
=
self
.
gallery_output_format
format
=
self
.
gallery_output_format
overwrite
=
self
.
gallery_overwrite
overwrite
=
self
.
gallery_overwrite
...
@@ -140,10 +143,12 @@ class DracDatasetBase:
...
@@ -140,10 +143,12 @@ class DracDatasetBase:
elif
image
.
ndim
!=
2
:
elif
image
.
ndim
!=
2
:
raise
ValueError
(
f
"
only 2D grayscale image are handled. Get
{
image
.
shape
}
"
)
raise
ValueError
(
f
"
only 2D grayscale image are handled. Get
{
image
.
shape
}
"
)
if
max_value
is
None
:
max_value
=
image
.
max
()
# clamp data in 0-256
# clamp data in 0-256
image
=
image
.
astype
(
numpy
.
float32
)
image
=
image
.
astype
(
numpy
.
float32
)
image
=
Binning
.
_bin_data
(
data
=
image
,
binning
=
binning
)
image
=
Binning
.
_bin_data
(
data
=
image
,
binning
=
binning
)
image
*=
255.0
/
image
.
max
()
image
*=
255.0
/
max_value
img
=
Image
.
fromarray
(
image
,
mode
=
None
)
img
=
Image
.
fromarray
(
image
,
mode
=
None
)
img
=
img
.
convert
(
"
L
"
)
img
=
img
.
convert
(
"
L
"
)
...
...
This diff is collapsed.
Click to expand it.
src/tomwer/core/process/drac/processeddataset.py
+
2
−
0
View file @
aec79e40
...
@@ -102,6 +102,7 @@ class IcatReconstructedVolumeDataset(DracDatasetBase):
...
@@ -102,6 +102,7 @@ class IcatReconstructedVolumeDataset(DracDatasetBase):
gallery_dir
=
self
.
get_gallery_dir
()
gallery_dir
=
self
.
get_gallery_dir
()
volume
=
self
.
tomo_obj
volume
=
self
.
tomo_obj
slices
=
volume
.
get_slices
(
slices
=
self
.
get_slices_to_extract
())
slices
=
volume
.
get_slices
(
slices
=
self
.
get_slices_to_extract
())
slices_stack
=
numpy
.
concatenate
(
list
([
slice_
for
slice_
in
slices
.
values
()]))
for
(
axis
,
slice_index
),
slice_
in
slices
.
items
():
for
(
axis
,
slice_index
),
slice_
in
slices
.
items
():
self
.
save_to_gallery
(
self
.
save_to_gallery
(
output_file_name
=
self
.
get_output_file_name
(
output_file_name
=
self
.
get_output_file_name
(
...
@@ -111,6 +112,7 @@ class IcatReconstructedVolumeDataset(DracDatasetBase):
...
@@ -111,6 +112,7 @@ class IcatReconstructedVolumeDataset(DracDatasetBase):
volume
=
volume
,
volume
=
volume
,
),
),
image
=
slice_
,
image
=
slice_
,
max_value
=
numpy
.
max
(
slices_stack
),
)
)
@staticmethod
@staticmethod
...
...
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