From f5ebf80396a3ab0f0507407751061fc32345a805 Mon Sep 17 00:00:00 2001 From: Dale-Black Date: Fri, 26 Nov 2021 15:25:34 -0800 Subject: [PATCH 1/2] update --- src/DICOM.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DICOM.jl b/src/DICOM.jl index ad592c9..983cd33 100644 --- a/src/DICOM.jl +++ b/src/DICOM.jl @@ -140,7 +140,7 @@ function isdicom(file) bytes = read(file, 132)[end-3:end] String(bytes) == "DICM" catch - not_dicom == true + "Not a dicom file" end end From 7aa402f0e6c924a6e327e0205948435fcb8e6f5e Mon Sep 17 00:00:00 2001 From: Dale-Black Date: Fri, 26 Nov 2021 17:31:22 -0800 Subject: [PATCH 2/2] update --- src/DICOM.jl | 2 +- test/runtests.jl | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/DICOM.jl b/src/DICOM.jl index 983cd33..6572256 100644 --- a/src/DICOM.jl +++ b/src/DICOM.jl @@ -140,7 +140,7 @@ function isdicom(file) bytes = read(file, 132)[end-3:end] String(bytes) == "DICM" catch - "Not a dicom file" + println("not a dicom file") end end diff --git a/test/runtests.jl b/test/runtests.jl index 4fe4acb..22897ba 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -226,9 +226,19 @@ end @testset "Parse entire folder" begin # Following files have missing preamble and won't be parsed # ["OT_Implicit_Little_Headless.dcm", "CT_Implicit_Little_Headless_Retired.dcm"] + # and brain.bpm is not a DICOM file dcms = dcmdir_parse(data_folder) @test issorted([dcm[tag"Instance Number"] for dcm in dcms]) - @test length(dcms) == length(readdir(data_folder)) - 2 # -2 because of note above + @test length(dcms) == length(readdir(data_folder)) - 3 # -3 because of note above +end + +@testset "isdicom" begin + answer = DICOM.isdicom("test/testdata/brain.bmp") + @test answer === nothing + + fileDX = download_dicom("DX_Implicit_Little_Interleaved.dcm") + answer2 = DICOM.isdicom(fileDX) + @test answer2 == true end @testset "Test tag macro" begin