comparison OrthancServer/Sources/ServerContext.cpp @ 5426:c65e036d649b

StorageCache is now storing transcoded instances + added ?transcode=... option to the /file route.
author Alain Mazy <am@osimis.io>
date Thu, 16 Nov 2023 16:09:04 +0100
parents d37dff2c0028
children 111e21b4f8bc
comparison
equal deleted inserted replaced
5425:e2c9f9d9700e 5426:c65e036d649b
1946 hasMoveOriginator, moveOriginatorAet, moveOriginatorId); 1946 hasMoveOriginator, moveOriginatorAet, moveOriginatorId);
1947 } 1947 }
1948 } 1948 }
1949 1949
1950 1950
1951 bool ServerContext::TranscodeWithCache(std::string& target,
1952 const std::string& source,
1953 const std::string& sourceInstanceId,
1954 DicomTransferSyntax targetSyntax)
1955 {
1956 StorageCache::Accessor cacheAccessor(storageCache_);
1957
1958 if (!cacheAccessor.FetchTranscodedInstance(target, sourceInstanceId, targetSyntax))
1959 {
1960 IDicomTranscoder::DicomImage sourceDicom;
1961 sourceDicom.SetExternalBuffer(source);
1962
1963 IDicomTranscoder::DicomImage targetDicom;
1964 std::set<DicomTransferSyntax> syntaxes;
1965 syntaxes.insert(targetSyntax);
1966
1967 if (Transcode(targetDicom, sourceDicom, syntaxes, true))
1968 {
1969 cacheAccessor.AddTranscodedInstance(sourceInstanceId, targetSyntax, reinterpret_cast<const char*>(targetDicom.GetBufferData()), targetDicom.GetBufferSize());
1970 target = std::string(reinterpret_cast<const char*>(targetDicom.GetBufferData()), targetDicom.GetBufferSize());
1971 return true;
1972 }
1973
1974 return false;
1975 }
1976
1977 return true;
1978 }
1979
1980
1951 bool ServerContext::Transcode(DicomImage& target, 1981 bool ServerContext::Transcode(DicomImage& target,
1952 DicomImage& source /* in, "GetParsed()" possibly modified */, 1982 DicomImage& source /* in, "GetParsed()" possibly modified */,
1953 const std::set<DicomTransferSyntax>& allowedSyntaxes, 1983 const std::set<DicomTransferSyntax>& allowedSyntaxes,
1954 bool allowNewSopInstanceUid) 1984 bool allowNewSopInstanceUid)
1955 { 1985 {