Пример #1
0
 public IAsyncResult BeginWalk(IDicomDatasetWalker walker, AsyncCallback callback, object state)
 {
     _walker = walker;
     _exception = null;
     _async = new EventAsyncResult(callback, state);
     ThreadPool.QueueUserWorkItem(Walk, null);
     return _async;
 }
Пример #2
0
        public static IAsyncResult BeginOpen(string fileName, AsyncCallback callback, object state)
        {
            DicomFile df = new DicomFile();
            df.File = new FileReference(fileName);

            FileByteSource source = new FileByteSource(df.File);

            EventAsyncResult result = new EventAsyncResult(callback, state);

            DicomFileReader reader = new DicomFileReader();
            reader.BeginRead(source,
                new DicomDatasetReaderObserver(df.FileMetaInfo),
                new DicomDatasetReaderObserver(df.Dataset),
                OnReadComplete, new Tuple<DicomFileReader, DicomFile, EventAsyncResult>(reader, df, result));

            return result;
        }
Пример #3
0
		public void BeginSave(string fileName, AsyncCallback callback, object state) {
			if (Format == DicomFileFormat.ACRNEMA1 || Format == DicomFileFormat.ACRNEMA2)
				throw new DicomFileException(this, "Unable to save ACR-NEMA file");

			if (Format == DicomFileFormat.DICOM3NoFileMetaInfo) {
				// create file meta information from dataset
				FileMetaInfo = new DicomFileMetaInformation(Dataset);
			}

			File = new FileReference(fileName);
			File.Delete();

			OnSave();

			FileByteTarget target = new FileByteTarget(File);

			EventAsyncResult result = new EventAsyncResult(callback, state);

			DicomFileWriter writer = new DicomFileWriter(DicomWriteOptions.Default);
			writer.BeginWrite(target, FileMetaInfo, Dataset, OnWriteComplete, new Tuple<DicomFileWriter, EventAsyncResult>(writer, result));
		}