コード例 #1
0
		/// <summary>
		/// Constructs a serialization-capable DICOM softcopy presentation state object.
		/// </summary>
		/// <param name="presentationStateSopClass">The SOP class of this type of softcopy presentation state.</param>
		protected DicomSoftcopyPresentationState(SopClass presentationStateSopClass)
		{
			_presentationSopClass = presentationStateSopClass;
			_dicomFile = new DicomFile();

			_serialized = false;
			_sourceAETitle = string.Empty;
			_stationName = string.Empty;
			_institution = Institution.Empty;
			Manufacturer = "ClearCanvas Inc.";
			ManufacturersModelName = ProductInformation.GetName(false, false);
			DeviceSerialNumber = string.Empty;
			SoftwareVersions = ProductInformation.GetVersion(true, true, true, true);
			_presentationInstanceNumber = 1;
			_presentationSopInstanceUid = string.Empty;
			_presentationSeriesDateTime = Platform.Time;
			_presentationSeriesNumber = null;
			_presentationSeriesInstanceUid = string.Empty;
			_presentationLabel = "FOR_PRESENTATION";
		}
コード例 #2
0
ファイル: ImageSop.cs プロジェクト: jfphilbin/ClearCanvas
		/// <summary>
		/// Checks whether or not the specified SOP Class indicates a supported image type.
		/// </summary>
		/// <param name="sopClass">The SOP Class to be checked.</param>
		/// <returns>True if the SOP Class is a supported image type; False otherwise.</returns>
		public static bool IsSupportedSopClass(SopClass sopClass)
		{
			return IsImageSop(sopClass);
		}
コード例 #3
0
		private static DicomFile CreateInstance(int number, string description, SopClass sopClass, DicomAttributeCollection baseDataSet)
		{
			DateTime now = DateTime.Now;
			DicomUid sopInstanceUid = DicomUid.GenerateUid();
			DicomFile dicomFile = new DicomFile(string.Empty, new DicomAttributeCollection(), baseDataSet.Copy(true, true, true));

			//meta info
			dicomFile.MediaStorageSopInstanceUid = sopInstanceUid.UID;
			dicomFile.MediaStorageSopClassUid = sopClass.Uid;

			//Series
			dicomFile.DataSet[DicomTags.Modality].SetStringValue("OT");
			dicomFile.DataSet[DicomTags.SeriesInstanceUid].SetStringValue(DicomUid.GenerateUid().UID);
			dicomFile.DataSet[DicomTags.SeriesNumber].SetInt32(0, number);
			dicomFile.DataSet[DicomTags.SeriesDescription].SetStringValue(description);

			//General Image
			dicomFile.DataSet[DicomTags.InstanceNumber].SetInt32(0, 1);

			//SC Image
			dicomFile.DataSet[DicomTags.DateOfSecondaryCapture].SetDateTime(0, now);
			dicomFile.DataSet[DicomTags.TimeOfSecondaryCapture].SetDateTime(0, now);

			//Sop Common
			dicomFile.DataSet[DicomTags.InstanceCreationDate].SetDateTime(0, now);
			dicomFile.DataSet[DicomTags.InstanceCreationTime].SetDateTime(0, now);
			dicomFile.DataSet[DicomTags.SopClassUid].SetStringValue(sopClass.Uid);
			dicomFile.DataSet[DicomTags.SopInstanceUid].SetStringValue(sopInstanceUid.UID);

			return dicomFile;
		}
コード例 #4
0
ファイル: Sop.cs プロジェクト: jasper-yeh/ClearCanvas
		// TODO (CR Jun 2012): Move to a more common place, like a SopClassExtensions class in IV.Common, or CC.Dicom?

		internal static bool IsImageSop(SopClass sopClass)
		{
			return _imageSopClasses.Contains(sopClass);
		}
コード例 #5
0
		private static ISopDataSource CreateMockDataset(string modality, SopClass sopClass, SizeF? imagerPixelSpacing, SizeF? pixelSpacing, string pixelSpacingCalibrationType, string pixelSpacingCalibrationDescription, double? estimatedRadiographicMagnification)
		{
			var dicomFile = new DicomFile();
			var dataset = dicomFile.DataSet;
			dataset[DicomTags.PatientId].SetStringValue("PATIENT");
			dataset[DicomTags.PatientsName].SetStringValue("YOSHI");
			dataset[DicomTags.StudyId].SetStringValue("STUDY");
			dataset[DicomTags.SeriesDescription].SetStringValue("SERIES");
			dataset[DicomTags.StudyInstanceUid].SetStringValue(DicomUid.GenerateUid().UID);
			dataset[DicomTags.SeriesInstanceUid].SetStringValue(DicomUid.GenerateUid().UID);
			dataset[DicomTags.Modality].SetStringValue(modality);
			dataset[DicomTags.SopInstanceUid].SetStringValue(DicomUid.GenerateUid().UID);
			dataset[DicomTags.SopClassUid].SetStringValue(sopClass.Uid);
			dataset[DicomTags.FrameOfReferenceUid].SetStringValue(DicomUid.GenerateUid().UID);
			dataset[DicomTags.PhotometricInterpretation].SetStringValue("MONOCHROME2");
			dataset[DicomTags.BitsStored].SetInt32(0, 16);
			dataset[DicomTags.BitsAllocated].SetInt32(0, 16);
			dataset[DicomTags.HighBit].SetInt32(0, 15);
			dataset[DicomTags.PixelRepresentation].SetInt32(0, 0);
			dataset[DicomTags.Rows].SetInt32(0, 100);
			dataset[DicomTags.Columns].SetInt32(0, 100);
			dataset[DicomTags.WindowCenter].SetInt32(0, 32768);
			dataset[DicomTags.WindowWidth].SetInt32(0, 65536);
			dataset[DicomTags.WindowCenterWidthExplanation].SetString(0, "Full Window");

			if (imagerPixelSpacing.HasValue)
			{
				dataset[DicomTags.ImagerPixelSpacing].SetFloat32(0, imagerPixelSpacing.Value.Height);
				dataset[DicomTags.ImagerPixelSpacing].SetFloat32(1, imagerPixelSpacing.Value.Width);
			}

			if (pixelSpacing.HasValue)
			{
				dataset[DicomTags.PixelSpacing].SetFloat32(0, pixelSpacing.Value.Height);
				dataset[DicomTags.PixelSpacing].SetFloat32(1, pixelSpacing.Value.Width);
			}

			if (!string.IsNullOrEmpty(pixelSpacingCalibrationType))
				dataset[DicomTags.PixelSpacingCalibrationType].SetStringValue(pixelSpacingCalibrationType);

			if (!string.IsNullOrEmpty(pixelSpacingCalibrationDescription))
				dataset[DicomTags.PixelSpacingCalibrationDescription].SetStringValue(pixelSpacingCalibrationDescription);

			if (estimatedRadiographicMagnification.HasValue)
				dataset[DicomTags.EstimatedRadiographicMagnificationFactor].SetFloat64(0, estimatedRadiographicMagnification.Value);

			return new TestDataSource(dicomFile);
		}
コード例 #6
0
ファイル: SopClass.cs プロジェクト: jfphilbin/ClearCanvas
 public static SopClass RegisterSopClass(SopClass sopClass)
 {
     SopClass theSop;
     if (!_sopList.TryGetValue(sopClass.Uid, out theSop))
         _sopList.Add(sopClass.Uid, theSop = sopClass);
     return theSop;
 }
コード例 #7
0
ファイル: SopClass.cs プロジェクト: jfphilbin/ClearCanvas
 /// <summary>Retrieve a SopClass object associated with the Uid.</summary>
 public static SopClass GetSopClass(String uid)
 {
     SopClass theSop;
     if (!_sopList.TryGetValue(uid, out theSop))
     {
         var newSop = new SopClass(string.Format("Generated: '{0}'", uid), uid, SopClassCategory.Uncategorized);
         theSop = RegisterSopClass(newSop);
     }
     return theSop;
 }
コード例 #8
0
		/// <summary>
		/// Constructs a deserialization-only DICOM softcopy presentation state object.
		/// </summary>
		/// <param name="psSopClass">The SOP class of this type of softcopy presentation state.</param>
		/// <param name="dataSource">An attribute collection containing the presentation state.</param>
		protected DicomSoftcopyPresentationState(SopClass psSopClass, DicomAttributeCollection dataSource)
			: this(psSopClass, new DicomFile("", CreateMetaInfo(dataSource), dataSource)) {}
コード例 #9
0
		/// <summary>
		/// Constructs a deserialization-only DICOM softcopy presentation state object.
		/// </summary>
		/// <param name="psSopClass">The SOP class of this type of softcopy presentation state.</param>
		/// <param name="dicomFile">The presentation state file.</param>
		protected DicomSoftcopyPresentationState(SopClass psSopClass, DicomFile dicomFile)
		{
			if (dicomFile.MediaStorageSopClassUid != psSopClass.Uid)
			{
				string message = string.Format("The specified DICOM file is not of a compatible SOP Class. Expected: {0}; Found: {1}",
				                               psSopClass, SopClass.GetSopClass(dicomFile.MediaStorageSopClassUid));
				throw new ArgumentException(message, "dicomFile");
			}

			_presentationSopClass = psSopClass;
			_dicomFile = dicomFile;

			_serialized = true;
			_sourceAETitle = _dicomFile.SourceApplicationEntityTitle;
			_stationName = _dicomFile.DataSet[DicomTags.StationName].ToString();
			_institution = Institution.GetInstitution(_dicomFile);
			Manufacturer = _dicomFile.DataSet[DicomTags.Manufacturer].ToString();
			ManufacturersModelName = _dicomFile.DataSet[DicomTags.ManufacturersModelName].ToString();
			DeviceSerialNumber = _dicomFile.DataSet[DicomTags.DeviceSerialNumber].ToString();
			SoftwareVersions = _dicomFile.DataSet[DicomTags.SoftwareVersions].ToString();
			_presentationInstanceNumber = _dicomFile.DataSet[DicomTags.InstanceNumber].GetInt32(0, 0);
			_presentationSopInstanceUid = _dicomFile.DataSet[DicomTags.SopInstanceUid].ToString();
			_presentationSeriesDateTime = DateTimeParser.ParseDateAndTime(_dicomFile.DataSet, 0, DicomTags.SeriesDate, DicomTags.SeriesTime);
			_presentationSeriesNumber = GetNullableInt32(_dicomFile.DataSet[DicomTags.SeriesNumber], 0);
			_presentationSeriesInstanceUid = _dicomFile.DataSet[DicomTags.SeriesInstanceUid].ToString();
			_presentationLabel = _dicomFile.DataSet[DicomTags.ContentLabel].ToString();
		}
コード例 #10
0
ファイル: SopClass.cs プロジェクト: UIKit0/ClearCanvas
 /// <summary>Retrieve a SopClass object associated with the Uid.</summary>
 public static SopClass GetSopClass(String uid)
 {
     SopClass theSop;
     if (!_sopList.TryGetValue(uid, out theSop))
     {
         theSop = new SopClass(string.Format("Generated: '{0}'", uid), uid, false); 
         _sopList.Add(uid, theSop);  
     }
     return theSop;
 }