Mercurial > hg > orthanc
comparison UnitTestsSources/FromDcmtkTests.cpp @ 3894:8f7ad4989fec transcoding
transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 07 May 2020 11:13:29 +0200 |
parents | 7a5fa8f307e9 |
children | 6762a97deabc |
comparison
equal
deleted
inserted
replaced
3893:7a5fa8f307e9 | 3894:8f7ad4989fec |
---|---|
1953 Orthanc::SystemToolbox::ReadFile(source, path); | 1953 Orthanc::SystemToolbox::ReadFile(source, path); |
1954 | 1954 |
1955 std::string c, i; | 1955 std::string c, i; |
1956 try | 1956 try |
1957 { | 1957 { |
1958 scu.Transcode(c, i, transcoder, source.c_str(), source.size()); | 1958 scu.Transcode(c, i, transcoder, source.c_str(), source.size(), false, "", 0); |
1959 } | 1959 } |
1960 catch (OrthancException& e) | 1960 catch (OrthancException& e) |
1961 { | 1961 { |
1962 if (e.GetErrorCode() == ErrorCode_NotImplemented) | 1962 if (e.GetErrorCode() == ErrorCode_NotImplemented) |
1963 { | 1963 { |
1989 DicomTransferSyntax a = (DicomTransferSyntax) i; | 1989 DicomTransferSyntax a = (DicomTransferSyntax) i; |
1990 std::set<DicomTransferSyntax> s; | 1990 std::set<DicomTransferSyntax> s; |
1991 s.insert(a); | 1991 s.insert(a); |
1992 | 1992 |
1993 std::string t; | 1993 std::string t; |
1994 | 1994 |
1995 if (!transcoder.TranscodeToBuffer(t, source.c_str(), source.size(), s, true)) | 1995 bool hasSopInstanceUidChanged; |
1996 | |
1997 if (!transcoder.TranscodeToBuffer(t, hasSopInstanceUidChanged, source.c_str(), source.size(), s, true)) | |
1996 { | 1998 { |
1997 printf("**************** CANNOT: [%s] => [%s]\n", | 1999 printf("**************** CANNOT: [%s] => [%s]\n", |
1998 GetTransferSyntaxUid(sourceSyntax), GetTransferSyntaxUid(a)); | 2000 GetTransferSyntaxUid(sourceSyntax), GetTransferSyntaxUid(a)); |
1999 } | 2001 } |
2000 else | 2002 else |
2001 { | 2003 { |
2004 bool lossy = (a == DicomTransferSyntax_JPEGProcess1 || | |
2005 a == DicomTransferSyntax_JPEGProcess2_4 || | |
2006 a == DicomTransferSyntax_JPEGLSLossy); | |
2007 | |
2002 printf("SIZE: %lu\n", t.size()); | 2008 printf("SIZE: %lu\n", t.size()); |
2009 if (hasSopInstanceUidChanged) | |
2010 { | |
2011 ASSERT_TRUE(lossy); | |
2012 } | |
2013 else | |
2014 { | |
2015 ASSERT_FALSE(lossy); | |
2016 } | |
2003 } | 2017 } |
2004 } | 2018 } |
2005 } | 2019 } |
2006 | 2020 |
2007 #endif | 2021 #endif |