Beispiel #1
0
		public FileByteTarget(FileReference file) {
			_file = file;
			_stream = _file.OpenWrite();
			_endian = Endian.LocalMachine;
			_writer = EndianBinaryWriter.Create(_stream, _endian);
			_lock = new object();
		}
Beispiel #2
0
		public FileByteSource(FileReference file) {
			_file = file;
			_stream = _file.OpenRead();
			_endian = Endian.LocalMachine;
			_reader = EndianBinaryReader.Create(_stream, _endian);
			_mark = 0;

			_largeObjectSize = 64 * 1024;

			_milestones = new Stack<long>();
			_lock = new object();
		}
Beispiel #3
0
		public void Save(string fileName) {
			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();

			using (var target = new FileByteTarget(File)) {
				DicomFileWriter writer = new DicomFileWriter(DicomWriteOptions.Default);
				writer.Write(target, FileMetaInfo, Dataset);
			}
		}
Beispiel #4
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));
		}