Mercurial > hg > orthanc
comparison UnitTestsSources/FromDcmtkTests.cpp @ 3812:abd3a1d114c0 transcoding
transcoding to 1.2.840.10008.1.2.4.51
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 07 Apr 2020 13:54:57 +0200 |
parents | 66e18aad0654 |
children | 1237bd0bbdb2 |
comparison
equal
deleted
inserted
replaced
3811:890af7156f19 | 3812:abd3a1d114c0 |
---|---|
2131 { | 2131 { |
2132 return true; | 2132 return true; |
2133 } | 2133 } |
2134 else if (syntaxes.find(DicomTransferSyntax_JPEGProcess1) != syntaxes.end() && | 2134 else if (syntaxes.find(DicomTransferSyntax_JPEGProcess1) != syntaxes.end() && |
2135 allowNewSopInstanceUid && | 2135 allowNewSopInstanceUid && |
2136 GetBitsStored() == 8 && | |
2136 FromDcmtkBridge::Transcode(target, *dicom_, DicomTransferSyntax_JPEGProcess1, &rpLossy)) | 2137 FromDcmtkBridge::Transcode(target, *dicom_, DicomTransferSyntax_JPEGProcess1, &rpLossy)) |
2138 { | |
2139 return true; | |
2140 } | |
2141 else if (syntaxes.find(DicomTransferSyntax_JPEGProcess2_4) != syntaxes.end() && | |
2142 allowNewSopInstanceUid && | |
2143 GetBitsStored() <= 12 && | |
2144 FromDcmtkBridge::Transcode(target, *dicom_, DicomTransferSyntax_JPEGProcess2_4, &rpLossy)) | |
2137 { | 2145 { |
2138 return true; | 2146 return true; |
2139 } | 2147 } |
2140 else | 2148 else |
2141 { | 2149 { |
2232 std::string s; | 2240 std::string s; |
2233 SystemToolbox::ReadFile(s, path); | 2241 SystemToolbox::ReadFile(s, path); |
2234 | 2242 |
2235 Orthanc::DcmtkTranscoder transcoder(s.c_str(), s.size()); | 2243 Orthanc::DcmtkTranscoder transcoder(s.c_str(), s.size()); |
2236 | 2244 |
2237 if (transcoder.GetBitsStored() != 8) // TODO | 2245 /*if (transcoder.GetBitsStored() != 8) // TODO |
2238 return; | 2246 return; */ |
2239 | 2247 |
2240 { | 2248 { |
2241 char buf[1024]; | 2249 char buf[1024]; |
2242 sprintf(buf, "/tmp/source-%06d.dcm", count); | 2250 sprintf(buf, "/tmp/source-%06d.dcm", count); |
2243 printf(">> %s\n", buf); | 2251 printf(">> %s\n", buf); |
2270 printf(">> %d %d ; %lu bytes\n", transcoder.GetTransferSyntax(), transcoder2.GetTransferSyntax(), t.size()); | 2278 printf(">> %d %d ; %lu bytes\n", transcoder.GetTransferSyntax(), transcoder2.GetTransferSyntax(), t.size()); |
2271 } | 2279 } |
2272 | 2280 |
2273 { | 2281 { |
2274 std::set<DicomTransferSyntax> syntaxes; | 2282 std::set<DicomTransferSyntax> syntaxes; |
2275 syntaxes.insert(DicomTransferSyntax_JPEGProcess1); | 2283 syntaxes.insert(DicomTransferSyntax_JPEGProcess2_4); |
2284 //syntaxes.insert(DicomTransferSyntax_LittleEndianExplicit); | |
2276 | 2285 |
2277 std::string t; | 2286 std::string t; |
2278 bool ok = transcoder.Transcode(t, syntaxes, false); | 2287 bool ok = transcoder.Transcode(t, syntaxes, true); |
2279 printf("Transcoding: %d\n", ok); | 2288 printf("Transcoding: %d\n", ok); |
2280 | 2289 |
2281 if (ok) | 2290 if (ok) |
2282 { | 2291 { |
2283 { | 2292 { |
2335 | 2344 |
2336 SystemToolbox::WriteFile(s, "source.dcm"); | 2345 SystemToolbox::WriteFile(s, "source.dcm"); |
2337 SystemToolbox::WriteFile(t, "target.dcm"); | 2346 SystemToolbox::WriteFile(t, "target.dcm"); |
2338 } | 2347 } |
2339 | 2348 |
2340 if (0) | 2349 if (1) |
2341 { | 2350 { |
2342 const char* const PATH = "/home/jodogne/Subversion/orthanc-tests/Database/TransferSyntaxes"; | 2351 const char* const PATH = "/home/jodogne/Subversion/orthanc-tests/Database/TransferSyntaxes"; |
2343 | 2352 |
2344 for (boost::filesystem::directory_iterator it(PATH); | 2353 for (boost::filesystem::directory_iterator it(PATH); |
2345 it != boost::filesystem::directory_iterator(); ++it) | 2354 it != boost::filesystem::directory_iterator(); ++it) |
2355 { | 2364 { |
2356 TestFile("/home/jodogne/Subversion/orthanc-tests/Database/Multiframe.dcm"); | 2365 TestFile("/home/jodogne/Subversion/orthanc-tests/Database/Multiframe.dcm"); |
2357 TestFile("/home/jodogne/Subversion/orthanc-tests/Database/Issue44/Monochrome1-Jpeg.dcm"); | 2366 TestFile("/home/jodogne/Subversion/orthanc-tests/Database/Issue44/Monochrome1-Jpeg.dcm"); |
2358 } | 2367 } |
2359 | 2368 |
2360 if (1) | 2369 if (0) |
2361 { | 2370 { |
2362 TestFile("/home/jodogne/Subversion/orthanc-tests/Database/TransferSyntaxes/1.2.840.10008.1.2.1.dcm"); | 2371 TestFile("/home/jodogne/Subversion/orthanc-tests/Database/TransferSyntaxes/1.2.840.10008.1.2.1.dcm"); |
2363 } | 2372 } |
2364 } | 2373 } |
2365 | 2374 |