Beispiel #1
0
        public static Volume Create(IEnumerable <string> filenames, CreateVolumeProgressCallback callback)
        {
            Platform.CheckForNullReference(filenames, "filenames");
            List <ImageSop> loadedImageSops = new List <ImageSop>();

            try
            {
                foreach (string fileName in filenames)
                {
                    try
                    {
                        loadedImageSops.Add(new ImageSop(fileName));
                    }
                    catch (Exception ex)
                    {
                        throw new ArgumentException(string.Format("Files must be valid DICOM image SOPs. File: {0}", fileName), ex);
                    }
                }

                List <Frame> frames = new List <Frame>();
                foreach (ImageSop sop in loadedImageSops)
                {
                    frames.AddRange(sop.Frames);
                }
                return(Create(frames, callback));
            }
            finally
            {
                foreach (ImageSop sop in loadedImageSops)
                {
                    sop.Dispose();
                }
            }
        }
Beispiel #2
0
 public FrameCopyProgressTracker(int count, CreateVolumeProgressCallback callback)
 {
     _current  = -1;                    // the callback notifies using frame index, not frame number, so the first callback should be 0
     _count    = count;
     _callback = callback;
     _synchronizationContext = SynchronizationContext.Current;
 }
Beispiel #3
0
			public VolumeBuilder(IEnumerable<IFrameReference> frames, CreateVolumeProgressCallback callback)
			{
				_callback = callback ?? delegate { };
				_frames = new List<IFrameReference>();
				foreach (IFrameReference frame in frames)
					_frames.Add(frame.Clone());
			}
Beispiel #4
0
		public static Volume Create(IEnumerable<string> filenames, CreateVolumeProgressCallback callback)
		{
			Platform.CheckForNullReference(filenames, "filenames");
			List<ImageSop> loadedImageSops = new List<ImageSop>();
			try
			{
				foreach (string fileName in filenames)
				{
					try
					{
						loadedImageSops.Add(new ImageSop(fileName));
					}
					catch (Exception ex)
					{
						throw new ArgumentException(string.Format("Files must be valid DICOM image SOPs. File: {0}", fileName), ex);
					}
				}

				List<Frame> frames = new List<Frame>();
				foreach (ImageSop sop in loadedImageSops)
					frames.AddRange(sop.Frames);
				return Create(frames, callback);
			}
			finally
			{
				foreach (ImageSop sop in loadedImageSops)
					sop.Dispose();
			}
		}
Beispiel #5
0
 public static Volume Create(IEnumerable <IFrameReference> frames, CreateVolumeProgressCallback callback)
 {
     Platform.CheckForNullReference(frames, "frames");
     using (VolumeBuilder builder = new VolumeBuilder(frames, callback))
     {
         return(builder.Build());
     }
 }
Beispiel #6
0
		public static Volume Create(IEnumerable<IFrameReference> frames, CreateVolumeProgressCallback callback)
		{
			Platform.CheckForNullReference(frames, "frames");
			using (VolumeBuilder builder = new VolumeBuilder(frames, callback))
			{
				return builder.Build();
			}
		}
Beispiel #7
0
 public VolumeBuilder(IEnumerable <IFrameReference> frames, CreateVolumeProgressCallback callback)
 {
     _callback = callback ?? delegate { };
     _frames   = new List <IFrameReference>();
     foreach (IFrameReference frame in frames)
     {
         _frames.Add(frame.Clone());
     }
 }
Beispiel #8
0
		public static Volume Create(IDisplaySet displaySet, CreateVolumeProgressCallback callback)
		{
			Platform.CheckForNullReference(displaySet, "displaySet");
			List<Frame> frames = new List<Frame>();

			foreach (IPresentationImage image in displaySet.PresentationImages)
			{
				IImageSopProvider imageSopProvider = image as IImageSopProvider;
				if (imageSopProvider == null)
					throw new ArgumentException("Images must be valid IImageSopProviders.");
				frames.Add(imageSopProvider.Frame);
			}
			return Create(frames, callback);
		}
Beispiel #9
0
        public static Volume Create(IDisplaySet displaySet, CreateVolumeProgressCallback callback)
        {
            Platform.CheckForNullReference(displaySet, "displaySet");
            List <Frame> frames = new List <Frame>();

            foreach (IPresentationImage image in displaySet.PresentationImages)
            {
                IImageSopProvider imageSopProvider = image as IImageSopProvider;
                if (imageSopProvider == null)
                {
                    throw new ArgumentException("Images must be valid IImageSopProviders.");
                }
                frames.Add(imageSopProvider.Frame);
            }
            return(Create(frames, callback));
        }
Beispiel #10
0
				public FrameCopyProgressTracker(int count, CreateVolumeProgressCallback callback)
				{
					_current = -1; // the callback notifies using frame index, not frame number, so the first callback should be 0
					_count = count;
					_callback = callback;
					_synchronizationContext = SynchronizationContext.Current;
				}