Mercurial > hg > orthanc
comparison UnitTestsSources/FromDcmtkTests.cpp @ 3945:0b3256c3ee14 transcoding
simplified IDicomTranscoder
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 19 May 2020 11:24:00 +0200 |
parents | 7dc5e7e0045d |
children | ef696db8426f |
comparison
equal
deleted
inserted
replaced
3944:aae045f802f4 | 3945:0b3256c3ee14 |
---|---|
1985 DcmtkTranscoder transcoder; | 1985 DcmtkTranscoder transcoder; |
1986 | 1986 |
1987 for (int i = 0; i <= DicomTransferSyntax_XML; i++) | 1987 for (int i = 0; i <= DicomTransferSyntax_XML; i++) |
1988 { | 1988 { |
1989 DicomTransferSyntax a = (DicomTransferSyntax) i; | 1989 DicomTransferSyntax a = (DicomTransferSyntax) i; |
1990 | |
1991 std::set<DicomTransferSyntax> s; | |
1992 s.insert(a); | |
1990 | 1993 |
1991 std::string t; | 1994 std::string t; |
1992 | 1995 |
1993 bool hasSopInstanceUidChanged; | 1996 bool hasSopInstanceUidChanged; |
1994 | 1997 |
1995 std::unique_ptr<DcmFileFormat> cloned(dynamic_cast<DcmFileFormat*>(toto->clone())); | 1998 IDicomTranscoder::DicomImage source, target; |
1996 if (!transcoder.TranscodeParsedToBuffer(t, hasSopInstanceUidChanged, *cloned, a, true)) | 1999 source.AcquireParsed(dynamic_cast<DcmFileFormat*>(toto->clone())); |
2000 | |
2001 if (!transcoder.Transcode(target, hasSopInstanceUidChanged, source, s, true)) | |
1997 { | 2002 { |
1998 printf("**************** CANNOT: [%s] => [%s]\n", | 2003 printf("**************** CANNOT: [%s] => [%s]\n", |
1999 GetTransferSyntaxUid(sourceSyntax), GetTransferSyntaxUid(a)); | 2004 GetTransferSyntaxUid(sourceSyntax), GetTransferSyntaxUid(a)); |
2000 } | 2005 } |
2001 else | 2006 else |
2002 { | 2007 { |
2003 DicomTransferSyntax targetSyntax; | 2008 DicomTransferSyntax targetSyntax; |
2004 ASSERT_TRUE(FromDcmtkBridge::LookupOrthancTransferSyntax(targetSyntax, *cloned)); | 2009 ASSERT_TRUE(FromDcmtkBridge::LookupOrthancTransferSyntax(targetSyntax, target.GetParsed())); |
2005 | 2010 |
2006 ASSERT_EQ(targetSyntax, a); | 2011 ASSERT_EQ(targetSyntax, a); |
2007 bool lossy = (a == DicomTransferSyntax_JPEGProcess1 || | 2012 bool lossy = (a == DicomTransferSyntax_JPEGProcess1 || |
2008 a == DicomTransferSyntax_JPEGProcess2_4 || | 2013 a == DicomTransferSyntax_JPEGProcess2_4 || |
2009 a == DicomTransferSyntax_JPEGLSLossy); | 2014 a == DicomTransferSyntax_JPEGLSLossy); |