37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
# ev-to-dicom
|
|
# Copyright © 2023 Lee Yingtong Li
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Affero General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
import sys
|
|
|
|
from .ev_to_dcm import ev_files_to_dcm_file
|
|
|
|
if len(sys.argv) < 7:
|
|
print('Usage: {} [study UID] [series UID] [series number (1-indexed)] [image number (1-indexed)] [input.bin]... [output.dcm]'.format(sys.argv[0]))
|
|
sys.exit(0)
|
|
|
|
study_uid = sys.argv[1]
|
|
series_uid = sys.argv[2]
|
|
series_number = sys.argv[3]
|
|
image_number = sys.argv[4]
|
|
input_filenames = sys.argv[5:-1]
|
|
output_filename = sys.argv[-1]
|
|
|
|
if not output_filename.endswith('.dcm'):
|
|
print('Output filename must end with .dcm')
|
|
sys.exit(1)
|
|
|
|
ev_files_to_dcm_file(study_uid, series_uid, series_number, image_number, input_filenames, output_filename)
|