示例#1
0
        public static bool CheckMemoryForLoadingSeries(List <Tuple <string, int> > seriesUidListAndCount, ICommunicationProxy proxy)
        {
            var    filmingDb       = FilmingDbOperation.Instance.FilmingDbWrapper;
            double estimatedMBytes = 0D;

            foreach (var series in seriesUidListAndCount)
            {
                var imageList = filmingDb.GetImageListBySeriesInstanceUID(series.Item1);
                estimatedMBytes += (double)imageList[0].Rows * imageList[0].Columns * imageList[0].SamplesPerPixel / 8.0 * imageList[0].BitsAllocated / 1024.0 / 1024.0 * FilmingUtility.MultipleOfCellPerImage * series.Item2;
                Logger.LogInfo("Cal:" + imageList[0].Rows + "*" + imageList[0].Columns + "*" + imageList[0].SamplesPerPixel + " / 8.0 *" + imageList[0].BitsAllocated + "/ 1024.0 / 1024.0 *" + FilmingUtility.MultipleOfCellPerImage + "*" + series.Item2);
            }
            MemoryManagement memoryManagement = new MemoryManagement();

            MemoryManagement._pCommProxy = proxy;
            //return memoryManagement.IsMemoryEnough((int)estimatedMBytes + 1);
            var canLoaded = memoryManagement.ReserveMemoryForCurrentApp((uint)estimatedMBytes);

            if (!canLoaded)
            {
                Logger.LogInfo("ReserveMemoryForCurrentApp:" + estimatedMBytes + "MBytes");
            }
            return(canLoaded);
        }