Ejemplo n.º 1
0
        protected virtual IEnumerable <IStorageLocation> TransformDataset
        (
            DicomDataset dataset,
            string mediaType,
            string instanceTransfer,
            int[] frameList = null
        )
        {
            var mediaProperties = new DicomMediaProperties(mediaType, instanceTransfer);
            var writerParams    = new DicomMediaWriterParameters( )
            {
                Dataset = dataset, MediaInfo = mediaProperties
            };
            var locationProvider = new MemoryStorageProvider( );


            if (null == frameList)
            {
                return(MediaWriterFactory.GetMediaWriter(mediaType).CreateMedia(writerParams, locationProvider));
            }
            else
            {
                return(MediaWriterFactory.GetMediaWriter(mediaType).CreateMedia(writerParams, locationProvider, frameList));
            }
        }
Ejemplo n.º 2
0
        static async Task Main(string[] args)
        {
            var jsonSerializer        = new Serializers.JsonSerializer(new JsonSerializerSettings());
            var fileStorageProvider   = new LocalStorageProvider(@".\");
            var memoryStorageProvider = new MemoryStorageProvider();

            var rawFileStorage   = new RawStorageClient(fileStorageProvider);
            var rawMemoryStorage = new RawStorageClient(memoryStorageProvider);

            var fileStorage   = new ObjectStorageClient(rawFileStorage, jsonSerializer);
            var memoryStorage = new ObjectStorageClient(rawMemoryStorage, jsonSerializer);

            Console.WriteLine("object memory storage");
            await TryStorage("test", memoryStorage);

            Console.WriteLine("object file storage");
            await TryStorage("test", fileStorage);

            Console.WriteLine("raw file storage");
            await TryRawStorage("test", rawFileStorage);

            Console.WriteLine("raw memory storage");
            await TryRawStorage("test", rawMemoryStorage);

            Console.WriteLine("Concurrent writes and reads");

            var tasks = Enumerable.Repeat(Enumerable.Range(1, 3).ToList(), 3)
                        .SelectMany(x => x)
                        .Select(x => TryRawStorage(x.ToString(), rawMemoryStorage));

            await Task.WhenAll(tasks);
        }
        public ScatterUnitTests()
        {
            var storageProvider = new MemoryStorageProvider();

            storageProvider.SetAppkey(UtilsHelper.ByteArrayToHexString(Sha256Manager.GetHash(Encoding.UTF8.GetBytes("appkey:0a182c0d054b6fd9f9361c82fcd040b46c41a6f61952a3ea"))));

            var scatter = new Scatter(new ScatterConfigurator()
            {
                AppName         = "SCATTER-SHARP",
                Network         = network,
                StorageProvider = storageProvider
            });

            ScatterUnitTestCases = new ScatterUnitTestCases(scatter, network);
        }