Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
qim3d
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
QIM
Tools
qim3d
Commits
9ebb5a15
Commit
9ebb5a15
authored
1 year ago
by
s204159
Committed by
fima
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
added parameter for dim_order
parent
ab3b1722
No related branches found
No related tags found
1 merge request
!77
added parameter for dim_order
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/releases.md
+1
-0
1 addition, 0 deletions
docs/releases.md
qim3d/io/loading.py
+8
-2
8 additions, 2 deletions
qim3d/io/loading.py
with
9 additions
and
2 deletions
docs/releases.md
+
1
−
0
View file @
9ebb5a15
...
...
@@ -14,6 +14,7 @@ And remember to keep your pip installation [up to date](/qim3d/#upgrade) so that
-
Fixed issue with Annotation tool and recent Gradio versions
-
New colormap:
`qim3d.viz.colormaps.qim`
, showcasing the Qim colors!
-
Object separation using
`qim3d.processing.operations.watershed`
-
Added option to pass
`dim_order`
to
`vol/vgi`
files
-
The 'Data Explorer' GUI now can load image sequences also
### v0.3.3 (11/04/2024)
...
...
This diff is collapsed.
Click to expand it.
qim3d/io/loading.py
+
8
−
2
View file @
9ebb5a15
...
...
@@ -67,11 +67,13 @@ class DataLoader:
return_metadata (bool, optional): Specifies whether to return metadata or not. Default is False (only for HDF5, TXRM/TXM/XRM and NIfTI files)
contains (str, optional): Specifies a part of the name that is common for the TIFF file stack to be loaded (only for TIFF stacks).
Default is None.
dim_order (tuple, optional): The order of the dimensions in the volume. Default is (2,1,0) which corresponds to (z,y,x)
"""
self
.
virtual_stack
=
kwargs
.
get
(
"
virtual_stack
"
,
False
)
self
.
dataset_name
=
kwargs
.
get
(
"
dataset_name
"
,
None
)
self
.
return_metadata
=
kwargs
.
get
(
"
return_metadata
"
,
False
)
self
.
contains
=
kwargs
.
get
(
"
contains
"
,
None
)
self
.
dim_order
=
kwargs
.
get
(
"
dim_order
"
,
(
2
,
1
,
0
))
def
load_tiff
(
self
,
path
):
"""
Load a TIFF file from the specified path.
...
...
@@ -428,11 +430,12 @@ class DataLoader:
case
_
:
raise
ValueError
(
f
"
Unsupported data type:
{
dt
}
"
)
dims_order
=
(
dims
[
self
.
dim_order
[
0
]],
dims
[
self
.
dim_order
[
1
]],
dims
[
self
.
dim_order
[
2
]])
if
self
.
virtual_stack
:
vol
=
np
.
memmap
(
vol_path
,
dtype
=
dt
,
mode
=
'
r
'
,
shape
=
(
dims
[
2
],
dims
[
0
],
dims
[
1
])
)
vol
=
np
.
memmap
(
vol_path
,
dtype
=
dt
,
mode
=
'
r
'
,
shape
=
dims
_order
)
else
:
vol
=
np
.
fromfile
(
vol_path
,
dtype
=
dt
,
count
=
np
.
prod
(
dims
))
vol
=
np
.
reshape
(
vol
,
(
dims
[
2
],
dims
[
0
],
dims
[
1
])
)
vol
=
np
.
reshape
(
vol
,
dims
_order
)
if
self
.
return_metadata
:
return
vol
,
meta_data
...
...
@@ -593,6 +596,7 @@ def load(
dataset_name
=
None
,
return_metadata
=
False
,
contains
=
None
,
dim_order
=
(
2
,
1
,
0
),
**
kwargs
,
):
"""
...
...
@@ -607,6 +611,7 @@ def load(
return_metadata (bool, optional): Specifies whether to return metadata or not. Default is False (only for HDF5 and TXRM/TXM/XRM files)
contains (str, optional): Specifies a part of the name that is common for the TIFF file stack to be loaded (only for TIFF stacks).
Default is None.
dim_order (tuple, optional): The order of the dimensions in the volume for .vol files. Default is (2,1,0) which corresponds to (z,y,x)
**kwargs: Additional keyword arguments to be passed
to the DataLoader constructor.
...
...
@@ -629,6 +634,7 @@ def load(
dataset_name
=
dataset_name
,
return_metadata
=
return_metadata
,
contains
=
contains
,
dim_order
=
dim_order
,
**
kwargs
,
)
...
...
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