public void Retrieve() { if (!_alreadyRetrieved) { //construct this object before the lock so there's no chance of deadlocking //with the parent data source (because we are accessing it's tags at the //same time as it's trying to get the pixel data). FramePixelDataRetriever retriever = new FramePixelDataRetriever(this, Parent.binaryStream, Parent.useBulkLoading); lock (_syncLock) { if (!_alreadyRetrieved) { DateTime start = DateTime.Now; _retrieveResult = retriever.Retrieve(); DateTime end = DateTime.Now; _lastRetrievePerformanceInfo = new StreamingPerformanceInfo(start, end, _retrieveResult.MetaData.ContentLength); _alreadyRetrieved = true; } } } }
public byte[] GetUncompressedPixelData(out string photometricInterpretation) { try { //construct this object before the lock so there's no chance of deadlocking //with the parent data source (because we are accessing its tags at the //same time as it's trying to get the pixel data). var retriever = new FramePixelDataRetriever(this); lock (_syncLock) { IFramePixelData framePixelData; if (_framePixelData == null) { AbortAttemptIfNecessary(); ResetAttemptData(); _retrievesAttempted++; framePixelData = retriever.Retrieve(); } else { framePixelData = _framePixelData; } //free this memory up in case it's holding a compressed buffer. _framePixelData = null; var clock = new CodeClock(); clock.Start(); //synchronize the call to decompress; it's really already synchronized by //the parent b/c it's only called from CreateFrameNormalizedPixelData, but it doesn't hurt. byte[] pixelData = framePixelData.GetPixelData(out photometricInterpretation); clock.Stop(); Platform.Log(LogLevel.Debug, "[Decompress Info] Sop/Frame: {0}/{1}, Transfer Syntax: {2}, Uncompressed bytes: {3}, Elapsed (s): {4}", retriever.SopInstanceUid, FrameNumber, retriever.TransferSyntaxUid, pixelData.Length, clock.Seconds); return(pixelData); } } catch (Exception ex) { _lastError = ex; throw; } }
public byte[] GetUncompressedPixelData() { //construct this object before the lock so there's no chance of deadlocking //with the parent data source (because we are accessing it's tags at the //same time as it's trying to get the pixel data). FramePixelDataRetriever retriever = new FramePixelDataRetriever(this, Parent.binaryStream, Parent.useBulkLoading); lock (_syncLock) { RetrievePixelDataResult result; if (_retrieveResult == null) { result = retriever.Retrieve(); } else { result = _retrieveResult; } //free this memory up in case it's holding a compressed buffer. _retrieveResult = null; CodeClock clock = new CodeClock(); clock.Start(); //synchronize the call to decompress; it's really already synchronized by //the parent b/c it's only called from CreateFrameNormalizedPixelData, but it doesn't hurt. byte[] pixelData = result.GetPixelData(); clock.Stop(); Platform.Log(LogLevel.Debug, "[Decompress Info] Sop/Frame: {0}/{1}, Transfer Syntax: {2}, Uncompressed bytes: {3}, Elapsed (s): {4}", retriever.SopInstanceUid, FrameNumber, retriever.TransferSyntaxUid, pixelData.Length, clock.Seconds); return(pixelData); } }
public void Retrieve() { if (!_alreadyRetrieved) { //construct this object before the lock so there's no chance of deadlocking //with the parent data source (because we are accessing it's tags at the //same time as it's trying to get the pixel data). FramePixelDataRetriever retriever = new FramePixelDataRetriever(this); lock (_syncLock) { if (!_alreadyRetrieved) { AbortAttemptIfNecessary(); try { ResetAttemptData(); _retrievesAttempted++; var start = DateTime.Now; _retrieveResult = retriever.Retrieve(); var end = DateTime.Now; _lastRetrievePerformanceInfo = new StreamingPerformanceInfo(start, end, _retrieveResult.MetaData.ContentLength); _alreadyRetrieved = true; } catch (Exception ex) { _lastError = ex; throw; } } } } }
public byte[] GetUncompressedPixelData() { try { //construct this object before the lock so there's no chance of deadlocking //with the parent data source (because we are accessing its tags at the //same time as it's trying to get the pixel data). FramePixelDataRetriever retriever = new FramePixelDataRetriever(this); lock (_syncLock) { RetrievePixelDataResult result; if (_retrieveResult == null) { AbortAttemptIfNecessary(); ResetAttemptData(); _retrievesAttempted++; result = retriever.Retrieve(); } else result = _retrieveResult; //free this memory up in case it's holding a compressed buffer. _retrieveResult = null; CodeClock clock = new CodeClock(); clock.Start(); //synchronize the call to decompress; it's really already synchronized by //the parent b/c it's only called from CreateFrameNormalizedPixelData, but it doesn't hurt. byte[] pixelData = result.GetPixelData(); clock.Stop(); Platform.Log(LogLevel.Debug, "[Decompress Info] Sop/Frame: {0}/{1}, Transfer Syntax: {2}, Uncompressed bytes: {3}, Elapsed (s): {4}", retriever.SopInstanceUid, FrameNumber, retriever.TransferSyntaxUid, pixelData.Length, clock.Seconds); return pixelData; } } catch(Exception ex) { _lastError = ex; throw; } }