Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mu-map
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
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tamino Huxohl
mu-map
Commits
ec3495df
Commit
ec3495df
authored
2 years ago
by
Tamino Huxohl
Browse files
Options
Downloads
Patches
Plain Diff
revice prepare script for a better mapping from projections to reconstructions and mu maps
parent
abe29b30
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
mu_map/data/dicom_util.py
+50
-0
50 additions, 0 deletions
mu_map/data/dicom_util.py
mu_map/data/prepare.py
+279
-393
279 additions, 393 deletions
mu_map/data/prepare.py
with
330 additions
and
393 deletions
.gitignore
+
1
−
0
View file @
ec3495df
anonymous.md
venv/
venv/
**__pycache__/
**__pycache__/
/data/
/data/
...
...
This diff is collapsed.
Click to expand it.
mu_map/data/dicom_util.py
0 → 100644
+
50
−
0
View file @
ec3495df
from
datetime
import
datetime
from
enum
import
Enum
import
pydicom
class
DICOMTime
(
Enum
):
Study
=
1
Series
=
2
Acquisition
=
3
Content
=
4
def
date_field
(
self
):
return
f
"
{
self
.
name
}
Date
"
def
time_field
(
self
):
return
f
"
{
self
.
name
}
Time
"
def
to_datetime
(
self
,
dicom
:
pydicom
.
dataset
.
FileDataset
)
->
datetime
:
_date
=
dicom
[
self
.
date_field
()].
value
_time
=
dicom
[
self
.
time_field
()].
value
return
datetime
(
year
=
int
(
_date
[
0
:
4
]),
month
=
int
(
_date
[
4
:
6
]),
day
=
int
(
_date
[
6
:
8
]),
hour
=
int
(
_time
[
0
:
2
]),
minute
=
int
(
_time
[
2
:
4
]),
second
=
int
(
_time
[
4
:
6
]),
# microsecond=int(_time.split(".")[1]),
)
def
parse_age
(
patient_age
:
str
)
->
int
:
"""
Parse an age string as defined in the DICOM standard into an integer representing the age in years.
:param patient_age: age string as defined in the DICOM standard
:return: the age in years as a number
"""
assert
(
type
(
patient_age
)
==
str
),
f
"
patient age needs to be a string and not
{
type
(
patient_age
)
}
"
assert
(
len
(
patient_age
)
==
4
),
f
"
patient age [
{
patient_age
}
] has to be four characters long
"
_num
,
_format
=
patient_age
[:
3
],
patient_age
[
3
]
assert
(
_format
==
"
Y
"
),
f
"
currently, only patient ages in years [Y] is supported, not [
{
_format
}
]
"
return
int
(
_num
)
This diff is collapsed.
Click to expand it.
mu_map/data/prepare.py
+
279
−
393
View file @
ec3495df
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