diff --git a/bin/ubuntu20.04/getdcmtags b/bin/ubuntu20.04/getdcmtags index af0b61d..e8b2a9d 100755 Binary files a/bin/ubuntu20.04/getdcmtags and b/bin/ubuntu20.04/getdcmtags differ diff --git a/bin/ubuntu22.04/getdcmtags b/bin/ubuntu22.04/getdcmtags index 6fd4740..c4fdf48 100755 Binary files a/bin/ubuntu22.04/getdcmtags and b/bin/ubuntu22.04/getdcmtags differ diff --git a/bin/ubuntu24.04/getdcmtags b/bin/ubuntu24.04/getdcmtags index 9989c39..a0758a5 100755 Binary files a/bin/ubuntu24.04/getdcmtags and b/bin/ubuntu24.04/getdcmtags differ diff --git a/getdcmtags/Dockerfile b/getdcmtags/Dockerfile new file mode 100644 index 0000000..756f3f0 --- /dev/null +++ b/getdcmtags/Dockerfile @@ -0,0 +1,21 @@ +ARG UBUNTU_VERSION=22.04 +FROM ubuntu:${UBUNTU_VERSION} +ENV DEBIAN_FRONTEND=noninteractive +# Install necessary packages +RUN apt-get update && apt-get install -y \ + build-essential \ + qtbase5-dev \ + dcmtk \ + libdcmtk-dev \ + jq \ + && rm -rf /var/lib/apt/lists/* + +# Set the working directory +WORKDIR /app + +# Copy the project files into the container +COPY . . +RUN mkdir /build + +# Set the default command +CMD qmake && make && ./test.sh && cp getdcmtags /build \ No newline at end of file diff --git a/getdcmtags/build.sh b/getdcmtags/build.sh new file mode 100644 index 0000000..cc7ac3b --- /dev/null +++ b/getdcmtags/build.sh @@ -0,0 +1,52 @@ +#!/bin/bash +set -euo pipefail + +build_docker_image() { + local UBUNTU_VERSION=$1 + + echo "Building Docker image for Ubuntu $UBUNTU_VERSION" + + # Build the Docker image + docker build --build-arg UBUNTU_VERSION=$UBUNTU_VERSION -t mercure-getdcmtags-build:$UBUNTU_VERSION . + + if [ $? -ne 0 ]; then + echo "Docker build failed for Ubuntu $UBUNTU_VERSION" + return 1 + fi + + echo "Docker image for Ubuntu $UBUNTU_VERSION built successfully" + echo "----------------------------------------" +} + + +build_qt_project() { + local UBUNTU_VERSION=$1 + + echo "Building for Ubuntu $UBUNTU_VERSION" + + docker run -it mercure-getdcmtags-build:$UBUNTU_VERSION + local last_container=$(docker ps -lq) + docker cp $last_container:/build/getdcmtags ../bin/ubuntu${UBUNTU_VERSION}/getdcmtags + docker rm $last_container + + echo "Build for Ubuntu $UBUNTU_VERSION completed" + echo "----------------------------------------" +} + +# Main execution +echo "Starting getdcmtags build" +echo "=======================================================" + +# Build for each Ubuntu version +for VERSION in 20.04 22.04 24.04; do + build_docker_image $VERSION +done + +# Run builds and extract executables for each Ubuntu version +for VERSION in 20.04 22.04 24.04; do + build_qt_project $VERSION +done + + + +echo "All builds completed" \ No newline at end of file diff --git a/getdcmtags/test.sh b/getdcmtags/test.sh new file mode 100644 index 0000000..c475698 --- /dev/null +++ b/getdcmtags/test.sh @@ -0,0 +1,46 @@ +#!/bin/bash +set -euo pipefail + +echo "Testing" +cp test_dcm test_dcm_copy +./getdcmtags test_dcm_copy sender_address sender_aet receiver_aet 0.0.0.0 asdf --set-tag forceKey=forcedValue +uid="1.2.276.0.7230010.3.1.3.9022104837472469675953272569912339663578" +if [ ! -e $uid/$uid#test_dcm_copy.tags ]; then + echo "Failed to create tags file" + exit 1 +fi + + +check_key() { + local key="$1" + local expected_value="$2" + local actual_value=$(jq -r ".$key // \"__NULL__\"" "$uid/$uid#test_dcm_copy.tags") + + if [ "$actual_value" == "__NULL__" ]; then + cat $uid/$uid#test_dcm_copy.tags + echo "Key '$key' not found in the JSON file." + echo "Test failed" + exit 1 + elif [ "$actual_value" == "$expected_value" ]; then + return + # echo "Key '$key' matches expected value: $actual_value" + else + cat $uid/$uid#test_dcm_copy.tags + echo "Key '$key' does not match. Expected: $expected_value, Actual: $actual_value" + echo "Test failed" + exit 1 + fi +} + + +check_key "Filename" "test_dcm_copy" +check_key "SenderAddress" "sender_address" +check_key "SenderAET" "sender_aet" +check_key "ReceiverAET" "receiver_aet" +check_key "SeriesInstanceUID" "$uid" +check_key "forceKey" "forcedValue" + +rm -f test_dcm_copy +rm -rf $uid + +echo "Success" \ No newline at end of file diff --git a/getdcmtags/test_dcm b/getdcmtags/test_dcm new file mode 100644 index 0000000..c7f768e Binary files /dev/null and b/getdcmtags/test_dcm differ