Mercurial > hg > orthanc
comparison UnitTestsSources/FromDcmtkTests.cpp @ 3951:5fe8c6d3212e transcoding
removed useless information "hasSopInstanceUidChanged"
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 19 May 2020 21:06:53 +0200 |
parents | ef696db8426f |
children | bd0af2e11325 |
comparison
equal
deleted
inserted
replaced
3950:5797ca4f3b8d | 3951:5fe8c6d3212e |
---|---|
1978 { | 1978 { |
1979 std::string source; | 1979 std::string source; |
1980 Orthanc::SystemToolbox::ReadFile(source, "/home/jodogne/Subversion/orthanc-tests/Database/KarstenHilbertRF.dcm"); | 1980 Orthanc::SystemToolbox::ReadFile(source, "/home/jodogne/Subversion/orthanc-tests/Database/KarstenHilbertRF.dcm"); |
1981 | 1981 |
1982 std::unique_ptr<DcmFileFormat> toto(FromDcmtkBridge::LoadFromMemoryBuffer(source.c_str(), source.size())); | 1982 std::unique_ptr<DcmFileFormat> toto(FromDcmtkBridge::LoadFromMemoryBuffer(source.c_str(), source.size())); |
1983 const std::string sourceUid = IDicomTranscoder::GetSopInstanceUid(*toto); | |
1984 | |
1983 DicomTransferSyntax sourceSyntax; | 1985 DicomTransferSyntax sourceSyntax; |
1984 ASSERT_TRUE(FromDcmtkBridge::LookupOrthancTransferSyntax(sourceSyntax, *toto)); | 1986 ASSERT_TRUE(FromDcmtkBridge::LookupOrthancTransferSyntax(sourceSyntax, *toto)); |
1985 | 1987 |
1986 DcmtkTranscoder transcoder; | 1988 DcmtkTranscoder transcoder; |
1987 | 1989 |
1992 std::set<DicomTransferSyntax> s; | 1994 std::set<DicomTransferSyntax> s; |
1993 s.insert(a); | 1995 s.insert(a); |
1994 | 1996 |
1995 std::string t; | 1997 std::string t; |
1996 | 1998 |
1997 bool hasSopInstanceUidChanged; | |
1998 | |
1999 IDicomTranscoder::DicomImage source, target; | 1999 IDicomTranscoder::DicomImage source, target; |
2000 source.AcquireParsed(dynamic_cast<DcmFileFormat*>(toto->clone())); | 2000 source.AcquireParsed(dynamic_cast<DcmFileFormat*>(toto->clone())); |
2001 | 2001 |
2002 if (!transcoder.Transcode(target, hasSopInstanceUidChanged, source, s, true)) | 2002 if (!transcoder.Transcode(target, source, s, true)) |
2003 { | 2003 { |
2004 printf("**************** CANNOT: [%s] => [%s]\n", | 2004 printf("**************** CANNOT: [%s] => [%s]\n", |
2005 GetTransferSyntaxUid(sourceSyntax), GetTransferSyntaxUid(a)); | 2005 GetTransferSyntaxUid(sourceSyntax), GetTransferSyntaxUid(a)); |
2006 } | 2006 } |
2007 else | 2007 else |
2013 bool lossy = (a == DicomTransferSyntax_JPEGProcess1 || | 2013 bool lossy = (a == DicomTransferSyntax_JPEGProcess1 || |
2014 a == DicomTransferSyntax_JPEGProcess2_4 || | 2014 a == DicomTransferSyntax_JPEGProcess2_4 || |
2015 a == DicomTransferSyntax_JPEGLSLossy); | 2015 a == DicomTransferSyntax_JPEGLSLossy); |
2016 | 2016 |
2017 printf("SIZE: %lu\n", t.size()); | 2017 printf("SIZE: %lu\n", t.size()); |
2018 if (hasSopInstanceUidChanged) | 2018 if (sourceUid == IDicomTranscoder::GetSopInstanceUid(target.GetParsed())) |
2019 { | |
2020 ASSERT_FALSE(lossy); | |
2021 } | |
2022 else | |
2019 { | 2023 { |
2020 ASSERT_TRUE(lossy); | 2024 ASSERT_TRUE(lossy); |
2021 } | 2025 } |
2022 else | |
2023 { | |
2024 ASSERT_FALSE(lossy); | |
2025 } | |
2026 } | 2026 } |
2027 } | 2027 } |
2028 } | 2028 } |
2029 | 2029 |
2030 #endif | 2030 #endif |