コード例 #1
0
		private void AddTagNodes(TreeNode parent, DicomSequenceItem record)
		{
			foreach (DicomAttribute attrib in record)
			{
				string name;
				if (attrib is DicomAttributeSQ || attrib is DicomAttributeOB || attrib is DicomAttributeOW || attrib is DicomAttributeOF)
					name = attrib.ToString();
				else
				{
					name = String.Format("{0}: {1}", attrib.Tag.ToString(), attrib.ToString());
				}
				TreeNode tagNode = new TreeNode(name);
				parent.Nodes.Add(tagNode);

				DicomAttributeSQ sqAttrib = attrib as DicomAttributeSQ;
				if (sqAttrib != null)
				{
					for (int i=0; i< sqAttrib.Count; i++)
					{
						TreeNode sqNode = new TreeNode("Sequence Item");
						tagNode.Nodes.Add(sqNode);
						AddTagNodes(sqNode, sqAttrib[i]);
					}
				}
			}
		}
コード例 #2
0
		/// <summary>
		/// Creates the PurposeOfReferenceCodeSequence in the underlying collection. Type 3.
		/// </summary>
		public CodeSequenceMacro CreatePurposeOfReferenceCodeSequence()
		{
			var dicomAttribute = DicomAttributeProvider[DicomTags.PurposeOfReferenceCodeSequence];
			if (dicomAttribute.IsNull || dicomAttribute.IsEmpty)
			{
				var dicomSequenceItem = new DicomSequenceItem();
				dicomAttribute.Values = new[] {dicomSequenceItem};
				var sequenceType = new CodeSequenceMacro(dicomSequenceItem);
				return sequenceType;
			}
			return new CodeSequenceMacro(((DicomSequenceItem[]) dicomAttribute.Values)[0]);
		}
コード例 #3
0
		/// <summary>
		/// Creates the value of ReferencedSopSequence in the underlying collection. Type 1.
		/// </summary>
		public ISopInstanceReferenceMacro CreateReferencedSopSequence()
		{
			DicomAttribute dicomAttribute = base.DicomAttributeProvider[DicomTags.ReferencedSopSequence];
			if (dicomAttribute.IsNull || dicomAttribute.Count == 0)
			{
				DicomSequenceItem dicomSequenceItem = new DicomSequenceItem();
				dicomAttribute.Values = new DicomSequenceItem[] {dicomSequenceItem};
				SopInstanceReferenceMacro iodBase = new SopInstanceReferenceMacro(dicomSequenceItem);
				iodBase.InitializeAttributes();
				return iodBase;
			}
			return new SopInstanceReferenceMacro(((DicomSequenceItem[]) dicomAttribute.Values)[0]);
		}
コード例 #4
0
		/// <summary>
		/// Creates the MaskSubtractionSequence in the underlying collection. Type 3.
		/// </summary>
		public IMaskSubtractionSequence CreateMaskSubtractionSequence()
		{
			DicomAttribute dicomAttribute = base.DicomAttributeProvider[DicomTags.MaskSubtractionSequence];
			if (dicomAttribute.IsNull || dicomAttribute.Count == 0)
			{
				DicomSequenceItem dicomSequenceItem = new DicomSequenceItem();
				dicomAttribute.Values = new DicomSequenceItem[] {dicomSequenceItem};
				IMaskSubtractionSequence sequenceType = new MaskSubtractionSequenceItem(dicomSequenceItem);
				sequenceType.InitializeAttributes();
				return sequenceType;
			}
			return new MaskSubtractionSequenceItem(((DicomSequenceItem[]) dicomAttribute.Values)[0]);
		}
コード例 #5
0
		/// <summary>
		/// Creates the MaskSubtractionSequence in the underlying collection. Type 1C.
		/// </summary>
		public MaskSubtractionSequenceIod CreateMaskSubtractionSequence()
		{
			var dicomAttribute = DicomAttributeProvider[DicomTags.MaskSubtractionSequence];
			if (dicomAttribute.IsNull || dicomAttribute.IsEmpty)
			{
				var dicomSequenceItem = new DicomSequenceItem();
				dicomAttribute.Values = new[] {dicomSequenceItem};
				var sequenceType = new MaskSubtractionSequenceIod(dicomSequenceItem);
				sequenceType.InitializeAttributes();
				return sequenceType;
			}
			return new MaskSubtractionSequenceIod(((DicomSequenceItem[]) dicomAttribute.Values)[0]);
		}
コード例 #6
0
		public void TestSequenceImplicitVr2()
		{
			var syntax = TransferSyntax.ImplicitVrLittleEndian;
			var sq = new DicomAttributeSQ(DicomTags.IconImageSequence);

			var item1 = new DicomSequenceItem();
			item1[DicomTags.AccessionNumber].SetStringValue("ABCDEFG");
			sq.AddSequenceItem(item1);

			var item2 = new DicomSequenceItem();
			item2[DicomTags.AccessionNumber].SetStringValue("XYZ");
			sq.AddSequenceItem(item2);

			// note: both sequence and item delimiter tags are calculated as part of the sequence - the item considers only the total length of its contents

			// item1_length = contents(16)
			Assert.AreEqual(16, item1[DicomTags.AccessionNumber].CalculateWriteLength(syntax, DicomWriteOptions.None), "Attr1 Length");
			Assert.AreEqual(16, item1.CalculateWriteLength(syntax, DicomWriteOptions.None), "Item1 Length");

			// item2_length = contents(12)
			Assert.AreEqual(12, item2[DicomTags.AccessionNumber].CalculateWriteLength(syntax, DicomWriteOptions.None), "Attr2 Length");
			Assert.AreEqual(12, item2.CalculateWriteLength(syntax, DicomWriteOptions.None), "Item2 Length");

			// sq_length = tag(4) + len(4) + item_tag(4) + item_len(4) + item1_length(16) + item_delimiter_tag(4) + item_delimiter_len(4)
			//                             + item_tag(4) + item_len(4) + item2_length(12) + item_delimiter_tag(4) + item_delimiter_len(4)
			//                             + sq_delimiter_tag(4) + sq_delimiter_len(4)
			var options = DicomWriteOptions.None;
			Assert.AreEqual(76, sq.CalculateWriteLength(syntax, options), "SQ Length (Options={0})", options);

			// sq_length = tag(4) + len(4) + item_tag(4) + item_len(4) + item1_length(16) + item_delimiter_tag(4) + item_delimiter_len(4)
			//                             + item_tag(4) + item_len(4) + item2_length(12) + item_delimiter_tag(4) + item_delimiter_len(4)
			options = DicomWriteOptions.ExplicitLengthSequence;
			Assert.AreEqual(68, sq.CalculateWriteLength(syntax, options), "SQ Length (Options={0})", options);

			// sq_length = tag(4) + len(4) + item_tag(4) + item_len(4) + item1_length(16)
			//                             + item_tag(4) + item_len(4) + item2_length(12)
			//                             + sq_delimiter_tag(4) + sq_delimiter_len(4)
			options = DicomWriteOptions.ExplicitLengthSequenceItem;
			Assert.AreEqual(60, sq.CalculateWriteLength(syntax, options), "SQ Length (Options={0})", options);

			// sq_length = tag(4) + len(4) + item_tag(4) + item_len(4) + item1_length(16)
			//                             + item_tag(4) + item_len(4) + item2_length(12)
			options = DicomWriteOptions.ExplicitLengthSequence | DicomWriteOptions.ExplicitLengthSequenceItem;
			Assert.AreEqual(52, sq.CalculateWriteLength(syntax, options), "SQ Length (Options={0})", options);
		}
コード例 #7
0
ファイル: AbstractTest.cs プロジェクト: shihao80/ClearCanvas
        public void SetupMultiframeXA(DicomAttributeCollection theSet, uint rows, uint columns, uint frames)
        {
            DateTime studyTime = DateTime.Now;

            theSet[DicomTags.SpecificCharacterSet].SetStringValue("ISO_IR 100");
            theSet[DicomTags.ImageType].SetStringValue("DERIVED\\SECONDARY\\SINGLE PLANE\\SINGLE A");
            theSet[DicomTags.InstanceCreationDate].SetStringValue(DateParser.ToDicomString(DateTime.Now));
            theSet[DicomTags.InstanceCreationTime].SetStringValue(TimeParser.ToDicomString(DateTime.Now));
            theSet[DicomTags.SopClassUid].SetStringValue(SopClass.XRayAngiographicImageStorageUid);
            theSet[DicomTags.SopInstanceUid].SetStringValue(DicomUid.GenerateUid().UID);
            theSet[DicomTags.StudyDate].SetStringValue(DateParser.ToDicomString(studyTime));
            theSet[DicomTags.StudyTime].SetStringValue(TimeParser.ToDicomString(studyTime));
            theSet[DicomTags.SeriesDate].SetStringValue(DateParser.ToDicomString(studyTime));
            theSet[DicomTags.SeriesTime].SetStringValue(TimeParser.ToDicomString(studyTime));
            theSet[DicomTags.AccessionNumber].SetStringValue("A4567");
            theSet[DicomTags.Modality].SetStringValue("XA");
            theSet[DicomTags.Manufacturer].SetStringValue("ClearCanvas");
            theSet[DicomTags.InstitutionName].SetStringValue("KardiologieUniklinikHeidelberg");
            theSet[DicomTags.ReferringPhysiciansName].SetStringValue("Last^First");
            theSet[DicomTags.StudyDescription].SetStringValue("HEART");
            theSet[DicomTags.SeriesDescription].SetStringValue("Heart 2D EPI BH TRA");
            theSet[DicomTags.PatientsName].SetStringValue("Patient^Test");
            theSet[DicomTags.PatientId].SetStringValue("ID123-45-9999");
            theSet[DicomTags.PatientsBirthDate].SetStringValue("19600101");
            theSet[DicomTags.PatientsSex].SetStringValue("M");
            theSet[DicomTags.PatientsWeight].SetStringValue("80");
            theSet[DicomTags.PatientsSize].SetStringValue("10.000244140625");
            theSet[DicomTags.Kvp].SetStringValue("80");
            theSet[DicomTags.ProtocolName].SetStringValue("25  FPS Koronarien");
            theSet[DicomTags.FrameTime].SetStringValue("40");
            theSet[DicomTags.FrameDelay].SetStringValue("0");
            theSet[DicomTags.DistanceSourceToDetector].SetStringValue("1018");
            theSet[DicomTags.ExposureTime].SetStringValue("7");
            theSet[DicomTags.XRayTubeCurrent].SetStringValue("815");
            theSet[DicomTags.RadiationSetting].SetStringValue("GR");
            theSet[DicomTags.IntensifierSize].SetStringValue("169.99998");
            theSet[DicomTags.PositionerMotion].SetStringValue("STATIC");
            theSet[DicomTags.PositionerPrimaryAngle].SetStringValue("-40.2999999");
            theSet[DicomTags.PositionerSecondaryAngle].SetStringValue("-15.5");
            theSet[DicomTags.DeviceSerialNumber].SetStringValue("1234");
            theSet[DicomTags.SoftwareVersions].SetStringValue("V1.0");
            theSet[DicomTags.StudyInstanceUid].SetStringValue(DicomUid.GenerateUid().UID);
            theSet[DicomTags.SeriesInstanceUid].SetStringValue(DicomUid.GenerateUid().UID);
            theSet[DicomTags.StudyId].SetStringValue("20021208125233");
            theSet[DicomTags.SeriesNumber].SetStringValue("1");
            theSet[DicomTags.AcquisitionNumber].SetStringValue("3");
            theSet[DicomTags.InstanceNumber].SetStringValue("13");
            theSet[DicomTags.PatientOrientation].SetNullValue();
            theSet[DicomTags.ImagesInAcquisition].SetStringValue("1");
            theSet[DicomTags.SamplesPerPixel].SetStringValue("1");
            theSet[DicomTags.PhotometricInterpretation].SetStringValue("MONOCHROME2");
            theSet[DicomTags.NumberOfFrames].SetUInt32(0, frames);
            theSet[DicomTags.Rows].SetUInt32(0, rows);
            theSet[DicomTags.Columns].SetUInt32(0, columns);
            theSet[DicomTags.FrameIncrementPointer].SetUInt32(0, DicomTags.FrameTime);
            theSet[DicomTags.BitsAllocated].SetStringValue("8");
            theSet[DicomTags.BitsStored].SetStringValue("8");
            theSet[DicomTags.HighBit].SetStringValue("7");
            theSet[DicomTags.PixelRepresentation].SetStringValue("0");
            theSet[DicomTags.WindowCenter].SetStringValue("128");
            theSet[DicomTags.WindowWidth].SetStringValue("204.8");
            theSet[DicomTags.PerformedProcedureStepStartDate].SetStringValue("20080219");
            theSet[DicomTags.PerformedProcedureStepStartTime].SetStringValue("143600");
            theSet[DicomTags.PerformedProcedureStepId].SetStringValue("UNKNOWN");

            // Null SQ Test
            theSet[DicomTags.ReferencedStudySequence].SetNullValue();

            // FL & FD tags for testing
            theSet[DicomTags.SlabThickness].SetFloat64(0, 0.1234567d);
            theSet[DicomTags.CalciumScoringMassFactorPatient].SetFloat32(0, 0.7654321f);

            uint length = rows * columns * frames;

            if (length % 2 == 1)
            {
                length++;
            }
            DicomAttributeOW pixels = new DicomAttributeOW(DicomTags.PixelData);

            byte[] pixelArray = new byte[length];
            pixelArray[length - 1] = 0x00; // Padding char

            for (uint frameCount = 0; frameCount < frames; frameCount++)
            {
                for (uint i = frameCount * rows * columns, val = frameCount + 1; i < (frameCount + 1) * rows * columns; i++, val++)
                {
                    pixelArray[i] = (byte)(val % 255);
                }
            }

            pixels.Values = pixelArray;

            theSet[DicomTags.PixelData] = pixels;

            DicomSequenceItem item = new DicomSequenceItem();

            theSet[DicomTags.RequestAttributesSequence].AddSequenceItem(item);

            item[DicomTags.RequestedProcedureId].SetStringValue("XA123");
            item[DicomTags.ScheduledProcedureStepId].SetStringValue("XA1234");

            item = new DicomSequenceItem();
            theSet[DicomTags.RequestAttributesSequence].AddSequenceItem(item);

            item[DicomTags.RequestedProcedureId].SetStringValue("XA123");
            item[DicomTags.ScheduledProcedureStepId].SetStringValue("XA1234");
        }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PersonIdentificationMacro"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The dicom sequence item.</param>
 public PersonIdentificationMacro(DicomSequenceItem dicomSequenceItem)
     : base(dicomSequenceItem)
 {
 }
コード例 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReferencedDigitalSignatureSequence"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The dicom sequence item.</param>
 public ReferencedDigitalSignatureSequence(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem)
 {
 }
コード例 #10
0
		/// <summary>
		/// Creates the PetFrameTypeSequence in the underlying collection. Type 1.
		/// </summary>
		public PetFrameTypeSequenceItem CreatePetFrameTypeSequence()
		{
			var dicomAttribute = DicomAttributeProvider[DicomTags.PetFrameTypeSequence];
			if (dicomAttribute.IsNull || dicomAttribute.IsEmpty)
			{
				var dicomSequenceItem = new DicomSequenceItem();
				dicomAttribute.Values = new[] {dicomSequenceItem};
				var sequenceType = new PetFrameTypeSequenceItem(dicomSequenceItem);
				return sequenceType;
			}
			return new PetFrameTypeSequenceItem(((DicomSequenceItem[]) dicomAttribute.Values)[0]);
		}
コード例 #11
0
			/// <summary>
			/// Initializes a new instance of the <see cref="ReferencedSopSequence"/> class.
			/// </summary>
			/// <param name="dicomSequenceItem">The dicom sequence item.</param>
			public ReferencedSopSequenceType(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem) {}
コード例 #12
0
ファイル: StudyXmlTests.cs プロジェクト: khaha2210/radio
		private static void MakeVoiLutSequenceB(DicomAttributeCollection dataSet)
		{
			DicomAttribute sequence = dataSet[DicomTags.VoiLutSequence];
			DicomSequenceItem[] items = (DicomSequenceItem[])sequence.Values;
			DicomSequenceItem[] newItems = new DicomSequenceItem[items.Length - 1];
			newItems[0] = items[0];
			newItems[1] = items[2];
			sequence.Values = newItems;
		}
コード例 #13
0
		public ViewCodeSequenceIod(DicomSequenceItem sequenceItem)
			: base(sequenceItem)
		{
		}
コード例 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PresentationLutSequenceItem"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The dicom sequence item.</param>
 public PresentationLutSequenceItem(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem)
 {
 }
コード例 #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GraphicAnnotationSequenceItem"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The dicom sequence item.</param>
 public GraphicAnnotationSequenceItem(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem)
 {
 }
コード例 #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GraphicObjectSequenceItem"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The dicom sequence item.</param>
 public GraphicObjectSequenceItem(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem)
 {
 }
コード例 #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TextObjectSequenceItem"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The dicom sequence item.</param>
 public TextObjectSequenceItem(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem)
 {
 }
コード例 #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProtocolContextSequenceClass"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The dicom sequence item.</param>
 public ProtocolContextSequenceClass(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem)
 {
 }
コード例 #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PerformedProtocolCodeSequenceClass"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The dicom sequence item.</param>
 public PerformedProtocolCodeSequenceClass(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem)
 {
 }
コード例 #20
0
		/// <summary>
		/// Initializes a new instance of the <see cref="PlaneOrientationVolumeSequenceItem"/> class.
		/// </summary>
		/// <param name="dicomSequenceItem">The DICOM sequence item.</param>
		public PlaneOrientationVolumeSequenceItem(DicomSequenceItem dicomSequenceItem)
			: base(dicomSequenceItem) {}
コード例 #21
0
		/// <summary>
		/// Initializes a new instance of the <see cref="DerivationImageSequenceItem"/> class.
		/// </summary>
		/// <param name="dicomSequenceItem">The DICOM sequence item.</param>
		public DerivationImageSequenceItem(DicomSequenceItem dicomSequenceItem)
			: base(dicomSequenceItem) {}
コード例 #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PatientSpeciesCodeSequence"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The dicom sequence item.</param>
 public PatientSpeciesCodeSequence(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem)
 {
     base.ContextIdentifier = "7454";
 }
コード例 #23
0
		/// <summary>
		/// Creates the value of ContentTemplateSequence in the underlying collection. Type 1C.
		/// </summary>
		ContentTemplateSequence IContainerMacro.CreateContentTemplateSequence() {
			DicomAttribute dicomAttribute = base.DicomAttributeProvider[DicomTags.ContentTemplateSequence];
			if (dicomAttribute.IsNull || dicomAttribute.Count == 0) {
				DicomSequenceItem dicomSequenceItem = new DicomSequenceItem();
				dicomAttribute.Values = new DicomSequenceItem[] { dicomSequenceItem };
				ContentTemplateSequence iodBase = new ContentTemplateSequence(dicomSequenceItem);
				iodBase.InitializeAttributes();
				return iodBase;
			}
			return new ContentTemplateSequence(((DicomSequenceItem[])dicomAttribute.Values)[0]);
		}
コード例 #24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReferencedInstanceSequenceIod"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The dicom sequence item.</param>
 public ReferencedInstanceSequenceIod(DicomSequenceItem dicomSequenceItem)
     : base(dicomSequenceItem)
 {
 }
		/// <summary>
		/// Initializes a new instance of the <see cref="XRayCalibrationDeviceUsageFunctionalGroup"/> class.
		/// </summary>
		/// <param name="dicomSequenceItem">The DICOM sequence item.</param>
		public XRayCalibrationDeviceUsageFunctionalGroup(DicomSequenceItem dicomSequenceItem)
			: base(dicomSequenceItem) {}
コード例 #26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ContentIdentificationMacro"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The dicom sequence item.</param>
 public ContentIdentificationMacro(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem)
 {
 }
コード例 #27
0
		/// <summary>
		/// Initializes a new instance of the <see cref="PetFrameTypeSequenceItem"/> class.
		/// </summary>
		/// <param name="dicomSequenceItem">The DICOM sequence item.</param>
		public PetFrameTypeSequenceItem(DicomSequenceItem dicomSequenceItem)
			: base(dicomSequenceItem) {}
コード例 #28
0
        public static DataLut Create(DicomSequenceItem item, bool isFirstMappedPixelSigned, bool isLutDataSigned)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            DicomAttribute descriptor = item[DicomTags.LutDescriptor];

            if (descriptor.Count < 3)
            {
                throw new DicomDataException("Invalid Lut Descriptor.");
            }

            ushort numEntries;

            if (!descriptor.TryGetUInt16(0, out numEntries))
            {
                throw new DicomDataException("Failed to get number of lut entries from Lut Descriptor.");
            }

            int numberOfEntries = numEntries;

            if (numberOfEntries == 0)
            {
                numberOfEntries = 65536;                 //2^16
            }
            int firstMappedPixelValue;

            if (isFirstMappedPixelSigned)
            {
                short firstMappedValue;
                if (!descriptor.TryGetInt16(1, out firstMappedValue))
                {
                    throw new DicomDataException("Failed to get first mapped pixel value from Lut Descriptor.");
                }

                firstMappedPixelValue = firstMappedValue;
            }
            else
            {
                ushort firstMappedValue;
                if (!descriptor.TryGetUInt16(1, out firstMappedValue))
                {
                    throw new DicomDataException("Failed to get first mapped pixel value from Lut Descriptor.");
                }

                firstMappedPixelValue = firstMappedValue;
            }

            ushort bitsPerEntry;

            if (!descriptor.TryGetUInt16(2, out bitsPerEntry))
            {
                throw new DicomDataException("Failed to get bits per entry from Lut Descriptor.");
            }

            int[]          data;
            DicomAttribute lutData = item[DicomTags.LutData];

            if (!IsValidAttribute(lutData))
            {
                throw new DicomDataException("Lut Data attribute must exist and have a valid value.");
            }

            if (lutData is DicomAttributeSS)
            {
                data = ExtractData(lutData.Values as short[], numberOfEntries, bitsPerEntry, isLutDataSigned);
            }
            else if (lutData is DicomAttributeUS)
            {
                data = ExtractData(lutData.Values as ushort[], numberOfEntries, bitsPerEntry, isLutDataSigned);
            }
            else if (lutData is DicomAttributeOW)
            {
                data = ExtractData(lutData.Values as byte[], numberOfEntries, bitsPerEntry, isLutDataSigned);
            }
            else
            {
                throw new DicomDataException("Invalid VR for LutData.");
            }

            return(new DataLut(firstMappedPixelValue, bitsPerEntry, data, item[DicomTags.LutExplanation].ToString()));
        }
コード例 #29
0
		/// <summary>
		/// Initializes a new instance of the <see cref="GraphicAnnotationSequenceItem"/> class.
		/// </summary>
		/// <param name="dicomSequenceItem">The dicom sequence item.</param>
		public GraphicAnnotationSequenceItem(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem) {}
コード例 #30
0
ファイル: AbstractTest.cs プロジェクト: shihao80/ClearCanvas
        public void SetupKoForImage(DicomAttributeCollection theSet, DicomAttributeCollection source)
        {
            theSet[DicomTags.SpecificCharacterSet] = source[DicomTags.SpecificCharacterSet].Copy();
            theSet[DicomTags.ImageType].SetStringValue("ORIGINAL\\PRIMARY\\OTHER\\M\\FFE");
            theSet[DicomTags.InstanceCreationDate].SetStringValue(DateParser.ToDicomString(DateTime.Now));
            theSet[DicomTags.InstanceCreationTime].SetStringValue(TimeParser.ToDicomString(DateTime.Now));
            theSet[DicomTags.SopClassUid].SetStringValue(SopClass.KeyObjectSelectionDocumentStorageUid);
            theSet[DicomTags.SopInstanceUid].SetStringValue(DicomUid.GenerateUid().UID);
            theSet[DicomTags.StudyDate] = source[DicomTags.StudyDate].Copy();
            theSet[DicomTags.StudyTime] = source[DicomTags.StudyTime].Copy();
            theSet[DicomTags.SeriesDate].SetStringValue(DateParser.ToDicomString(DateTime.Now));
            theSet[DicomTags.SeriesTime].SetStringValue(TimeParser.ToDicomString(DateTime.Now));
            theSet[DicomTags.ContentDate].SetStringValue(DateParser.ToDicomString(DateTime.Now));
            theSet[DicomTags.ContentTime].SetStringValue(TimeParser.ToDicomString(DateTime.Now));
            theSet[DicomTags.AccessionNumber] = source[DicomTags.AccessionNumber].Copy();
            theSet[DicomTags.Modality].SetStringValue("KO");
            theSet[DicomTags.Manufacturer].SetStringValue("ClearCanvas");
            theSet[DicomTags.ManufacturersModelName].SetNullValue();
            theSet[DicomTags.InstitutionName]         = source[DicomTags.InstitutionName].Copy();
            theSet[DicomTags.ReferringPhysiciansName] = source[DicomTags.ReferringPhysiciansName].Copy();
            theSet[DicomTags.StudyDescription]        = source[DicomTags.StudyDescription].Copy();
            theSet[DicomTags.SeriesDescription].SetStringValue("Teaching Series");
            theSet[DicomTags.PatientsName]      = source[DicomTags.PatientsName].Copy();
            theSet[DicomTags.PatientId]         = source[DicomTags.PatientId].Copy();
            theSet[DicomTags.PatientsBirthDate] = source[DicomTags.PatientsBirthDate].Copy();
            theSet[DicomTags.PatientsSex]       = source[DicomTags.PatientsSex].Copy();
            theSet[DicomTags.PatientsWeight]    = source[DicomTags.PatientsWeight].Copy();
            theSet[DicomTags.StudyInstanceUid]  = source[DicomTags.StudyInstanceUid].Copy();
            theSet[DicomTags.SeriesInstanceUid].SetStringValue(DicomUid.GenerateUid().UID);
            theSet[DicomTags.StudyId] = source[DicomTags.StudyId].Copy();
            theSet[DicomTags.SeriesNumber].SetStringValue("99");
            theSet[DicomTags.InstanceNumber].SetStringValue("1");

            theSet[DicomTags.ValueType].SetStringValue("CONTAINER");

            DicomSequenceItem item = new DicomSequenceItem();

            theSet[DicomTags.ConceptNameCodeSequence].AddSequenceItem(item);

            item[DicomTags.CodeValue].SetStringValue("113004");
            item[DicomTags.CodingSchemeDesignator].SetStringValue("DCM");
            item[DicomTags.CodeMeaning].SetStringValue("For Teaching");

            theSet[DicomTags.ContinuityOfContent].SetStringValue("SEPARATE");

            item = new DicomSequenceItem();
            theSet[DicomTags.CurrentRequestedProcedureEvidenceSequence].AddSequenceItem(item);

            DicomSequenceItem refSeriesItem = new DicomSequenceItem();

            item[DicomTags.ReferencedSeriesSequence].AddSequenceItem(refSeriesItem);
            refSeriesItem[DicomTags.SeriesInstanceUid] = source[DicomTags.SeriesInstanceUid].Copy();

            DicomSequenceItem refSopItem = new DicomSequenceItem();

            refSeriesItem[DicomTags.ReferencedSopSequence].AddSequenceItem(refSopItem);
            refSopItem[DicomTags.ReferencedSopClassUid].SetStringValue(source[DicomTags.SopClassUid].ToString());
            refSopItem[DicomTags.ReferencedSopInstanceUid].SetStringValue(source[DicomTags.SopInstanceUid].ToString());

            item[DicomTags.StudyInstanceUid] = source[DicomTags.StudyInstanceUid].Copy();

            item[DicomTags.RequestedProcedureId].SetStringValue("MR2R1234");
            item[DicomTags.ScheduledProcedureStepId].SetStringValue("MR2S1234");

            theSet[DicomTags.IdenticalDocumentsSequence].AddSequenceItem(new DicomSequenceItem(item.Copy(), true, true, true));

            DicomSequenceItem contentItem = new DicomSequenceItem();

            theSet[DicomTags.ContentSequence].AddSequenceItem(contentItem);

            contentItem[DicomTags.RelationshipType].SetStringValue("CONTAINS");
            contentItem[DicomTags.ValueType].SetStringValue("IMAGE");

            refSopItem = new DicomSequenceItem();
            contentItem[DicomTags.ReferencedSopSequence].AddSequenceItem(refSopItem);
            refSopItem[DicomTags.ReferencedSopClassUid].SetStringValue(source[DicomTags.SopClassUid].ToString());
            refSopItem[DicomTags.ReferencedSopInstanceUid].SetStringValue(source[DicomTags.SopInstanceUid].ToString());
            if (source.Contains(DicomTags.NumberOfFrames))
            {
                refSopItem[DicomTags.ReferencedFrameNumber].SetStringValue("1");
            }
            else
            {
                refSopItem[DicomTags.ReferencedFrameNumber].SetNullValue();
            }

            refSopItem[DicomTags.ReferencedSegmentNumber].SetNullValue();

            contentItem = new DicomSequenceItem();
            theSet[DicomTags.ContentSequence].AddSequenceItem(contentItem);

            contentItem[DicomTags.RelationshipType].SetStringValue("CONTAINS");
            contentItem[DicomTags.TextValue].SetStringValue("Teaching Images");

            item = new DicomSequenceItem();
            contentItem[DicomTags.ConceptNameCodeSequence].AddSequenceItem(item);
            item[DicomTags.CodeValue].SetStringValue("113012");
            item[DicomTags.CodingSchemeDesignator].SetStringValue("DCM");
            item[DicomTags.CodeMeaning].SetStringValue("Key Object Description");
        }
コード例 #31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BillingSuppliesAndDevicesSequenceIod"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The dicom sequence item.</param>
 public BillingSuppliesAndDevicesSequenceIod(DicomSequenceItem dicomSequenceItem)
     : base(dicomSequenceItem)
 {
 }
コード例 #32
0
        public void SetupDataSet(DicomAttributeCollection theSet, string characterSet)
        {
            DateTime studyTime = DateTime.Now;

            theSet[DicomTags.SpecificCharacterSet].SetStringValue(characterSet);
            theSet[DicomTags.ImageType].SetStringValue("ORIGINAL\\PRIMARY\\OTHER\\");
            theSet[DicomTags.InstanceCreationDate].SetStringValue(DateParser.ToDicomString(DateTime.Now));
            theSet[DicomTags.InstanceCreationTime].SetStringValue(TimeParser.ToDicomString(DateTime.Now));
            theSet[DicomTags.SopClassUid].SetStringValue(SopClass.SecondaryCaptureImageStorageUid);
            theSet[DicomTags.SopInstanceUid].SetStringValue(DicomUid.GenerateUid().UID);
            theSet[DicomTags.StudyDate].SetStringValue(DateParser.ToDicomString(studyTime));
            theSet[DicomTags.StudyTime].SetStringValue(TimeParser.ToDicomString(studyTime));
            theSet[DicomTags.SeriesDate].SetStringValue(DateParser.ToDicomString(studyTime));
            theSet[DicomTags.SeriesTime].SetStringValue(TimeParser.ToDicomString(studyTime));
            theSet[DicomTags.AccessionNumber].SetStringValue("A1234");
            theSet[DicomTags.Modality].SetStringValue("MR");
            theSet[DicomTags.Manufacturer].SetStringValue("ClearCanvas");
            theSet[DicomTags.ManufacturersModelName].SetNullValue();
            theSet[DicomTags.InstitutionName].SetStringValue("Toronto General Hospital");
            theSet[DicomTags.ReferringPhysiciansName].SetStringValue("Last^First");
            theSet[DicomTags.StudyDescription].SetStringValue("TEST");
            theSet[DicomTags.SeriesDescription].SetStringValue("TEST");
            theSet[DicomTags.PatientsName].SetStringValue("Patient^Test");
            theSet[DicomTags.PatientId].SetStringValue("ID123-45-9999");
            theSet[DicomTags.PatientsBirthDate].SetStringValue("19600102");
            theSet[DicomTags.PatientsSize].SetStringValue("10.000244140625");
            theSet[DicomTags.SequenceVariant].SetStringValue("OTHER");
            theSet[DicomTags.DeviceSerialNumber].SetStringValue("1234");
            theSet[DicomTags.SoftwareVersions].SetStringValue("V1.0");
            theSet[DicomTags.PatientPosition].SetStringValue("HFS");
            theSet[DicomTags.StudyInstanceUid].SetStringValue(DicomUid.GenerateUid().UID);
            theSet[DicomTags.SeriesInstanceUid].SetStringValue(DicomUid.GenerateUid().UID);
            theSet[DicomTags.StudyId].SetStringValue("1933");
            theSet[DicomTags.SeriesNumber].SetStringValue("1");
            theSet[DicomTags.InstanceNumber].SetStringValue("1");
            theSet[DicomTags.ImageComments].SetStringValue("Test SC Image");
            theSet[DicomTags.SamplesPerPixel].SetStringValue("1");
            theSet[DicomTags.PhotometricInterpretation].SetStringValue("MONOCHROME2");
            theSet[DicomTags.Rows].SetStringValue("256");
            theSet[DicomTags.Columns].SetStringValue("256");
            theSet[DicomTags.BitsAllocated].SetStringValue("16");
            theSet[DicomTags.BitsStored].SetStringValue("12");
            theSet[DicomTags.HighBit].SetStringValue("11");
            theSet[DicomTags.PixelRepresentation].SetStringValue("0");

            uint length = 256 * 256 * 2;

            DicomAttributeOW pixels = new DicomAttributeOW(DicomTags.PixelData);

            byte[] pixelArray = new byte[length];

            for (uint i = 0; i < length; i += 2)
            {
                pixelArray[i] = (byte)(i % 255);
            }

            pixels.Values = pixelArray;

            theSet[DicomTags.PixelData] = pixels;

            DicomSequenceItem item = new DicomSequenceItem();

            theSet[DicomTags.RequestAttributesSequence].AddSequenceItem(item);

            item[DicomTags.RequestedProcedureId].SetStringValue("MRR1234");
            item[DicomTags.ScheduledProcedureStepId].SetStringValue("MRS1234");

            item = new DicomSequenceItem();
            theSet[DicomTags.RequestAttributesSequence].AddSequenceItem(item);

            item[DicomTags.RequestedProcedureId].SetStringValue("MR2R1234");
            item[DicomTags.ScheduledProcedureStepId].SetStringValue("MR2S1234");

            DicomSequenceItem studyItem = new DicomSequenceItem();

            item[DicomTags.ReferencedStudySequence].AddSequenceItem(studyItem);

            studyItem[DicomTags.ReferencedSopClassUid].SetStringValue(SopClass.SecondaryCaptureImageStorageUid);
            studyItem[DicomTags.ReferencedSopInstanceUid].SetStringValue("1.2.3.4.5.6.7.8.9");
        }
コード例 #33
0
		/// <summary>
		/// Initializes a new instance of the <see cref="MrDiffusionSequenceItem"/> class.
		/// </summary>
		/// <param name="dicomSequenceItem">The DICOM sequence item.</param>
		public MrDiffusionSequenceItem(DicomSequenceItem dicomSequenceItem)
			: base(dicomSequenceItem) {}
コード例 #34
0
		/// <summary>
		/// Initializes a new instance of the <see cref="ReferencedSopInstanceMacSequence"/> class.
		/// </summary>
		/// <param name="dicomSequenceItem">The dicom sequence item.</param>
		public ReferencedSopInstanceMacSequence(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem) {}
コード例 #35
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DisplayedAreaSelectionSequenceItem"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The dicom sequence item.</param>
 public DisplayedAreaSelectionSequenceItem(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem)
 {
 }
コード例 #36
0
ファイル: AbstractTest.cs プロジェクト: shihao80/ClearCanvas
        public void SetupMR(DicomAttributeCollection theSet)
        {
            DateTime studyTime = DateTime.Now;

            theSet[DicomTags.SpecificCharacterSet].SetStringValue("ISO_IR 100");
            theSet[DicomTags.ImageType].SetStringValue("ORIGINAL\\PRIMARY\\OTHER\\M\\FFE");
            theSet[DicomTags.InstanceCreationDate].SetStringValue(DateParser.ToDicomString(DateTime.Now));
            theSet[DicomTags.InstanceCreationTime].SetStringValue(TimeParser.ToDicomString(DateTime.Now));
            theSet[DicomTags.AcquisitionDatetime].SetDateTime(0, DateTime.Now);
            theSet[DicomTags.SopClassUid].SetStringValue(SopClass.MrImageStorageUid);
            theSet[DicomTags.SopInstanceUid].SetStringValue(DicomUid.GenerateUid().UID);
            theSet[DicomTags.StudyDate].SetStringValue(DateParser.ToDicomString(studyTime));
            theSet[DicomTags.StudyTime].SetStringValue(TimeParser.ToDicomString(studyTime));
            theSet[DicomTags.SeriesDate].SetStringValue(DateParser.ToDicomString(studyTime));
            theSet[DicomTags.SeriesTime].SetStringValue(TimeParser.ToDicomString(studyTime));
            theSet[DicomTags.AccessionNumber].SetStringValue("A1234");
            theSet[DicomTags.Modality].SetStringValue("MR");
            theSet[DicomTags.Manufacturer].SetStringValue("ClearCanvas");
            theSet[DicomTags.ManufacturersModelName].SetNullValue();
            theSet[DicomTags.InstitutionName].SetStringValue("Mount Sinai Hospital");
            theSet[DicomTags.ReferringPhysiciansName].SetStringValue("Last^First");
            theSet[DicomTags.StudyDescription].SetStringValue("HEART");
            theSet[DicomTags.SeriesDescription].SetStringValue("Heart 2D EPI BH TRA");
            theSet[DicomTags.PatientsName].SetStringValue("Patient^Test");
            theSet[DicomTags.PatientId].SetStringValue("ID123-45-9999");
            theSet[DicomTags.PatientsBirthDate].SetStringValue("19600101");
            theSet[DicomTags.PatientsSex].SetStringValue("M");
            theSet[DicomTags.PatientsWeight].SetStringValue("70");
            theSet[DicomTags.PatientsSize].SetStringValue("10.000244140625");
            theSet[DicomTags.PatientsAge].SetStringValue("035Y");
            theSet[DicomTags.SequenceVariant].SetStringValue("OTHER");
            theSet[DicomTags.ScanOptions].SetStringValue("CG");
            theSet[DicomTags.MrAcquisitionType].SetStringValue("2D");
            theSet[DicomTags.SliceThickness].SetStringValue("10.000000");
            theSet[DicomTags.RepetitionTime].SetStringValue("857.142883");
            theSet[DicomTags.EchoTime].SetStringValue("8.712100");
            theSet[DicomTags.NumberOfAverages].SetStringValue("1");
            theSet[DicomTags.ImagingFrequency].SetStringValue("63.901150");
            theSet[DicomTags.ImagedNucleus].SetStringValue("1H");
            theSet[DicomTags.EchoNumbers].SetStringValue("1");
            theSet[DicomTags.MagneticFieldStrength].SetStringValue("1.500000");
            theSet[DicomTags.SpacingBetweenSlices].SetStringValue("10.00000");
            theSet[DicomTags.NumberOfPhaseEncodingSteps].SetStringValue("81");
            theSet[DicomTags.EchoTrainLength].SetStringValue("0");
            theSet[DicomTags.PercentSampling].SetStringValue("63.281250");
            theSet[DicomTags.PercentPhaseFieldOfView].SetStringValue("68.75000");
            theSet[DicomTags.DeviceSerialNumber].SetStringValue("1234");
            theSet[DicomTags.SoftwareVersions].SetStringValue("V1.0");
            theSet[DicomTags.ProtocolName].SetStringValue("2D EPI BH");
            theSet[DicomTags.TriggerTime].SetStringValue("14.000000");
            theSet[DicomTags.LowRRValue].SetStringValue("948");
            theSet[DicomTags.HighRRValue].SetStringValue("1178");
            theSet[DicomTags.IntervalsAcquired].SetStringValue("102");
            theSet[DicomTags.IntervalsRejected].SetStringValue("0");
            theSet[DicomTags.HeartRate].SetStringValue("56");
            theSet[DicomTags.ReceiveCoilName].SetStringValue("B");
            theSet[DicomTags.TransmitCoilName].SetStringValue("B");
            theSet[DicomTags.InPlanePhaseEncodingDirection].SetStringValue("COL");
            theSet[DicomTags.FlipAngle].SetStringValue("50.000000");
            theSet[DicomTags.PatientPosition].SetStringValue("HFS");
            theSet[DicomTags.StudyInstanceUid].SetStringValue(DicomUid.GenerateUid().UID);
            theSet[DicomTags.SeriesInstanceUid].SetStringValue(DicomUid.GenerateUid().UID);
            theSet[DicomTags.StudyId].SetStringValue("1933");
            theSet[DicomTags.SeriesNumber].SetStringValue("1");
            theSet[DicomTags.AcquisitionNumber].SetStringValue("7");
            theSet[DicomTags.InstanceNumber].SetStringValue("1");
            theSet[DicomTags.ImagePositionPatient].SetStringValue("-61.7564\\-212.04848\\-99.6208");
            theSet[DicomTags.ImageOrientationPatient].SetStringValue("0.861\\0.492\\0.126\\-0.2965");
            theSet[DicomTags.FrameOfReferenceUid].SetStringValue(DicomUid.GenerateUid().UID);
            theSet[DicomTags.PositionReferenceIndicator].SetStringValue(null);
            theSet[DicomTags.ImageComments].SetStringValue("Test MR Image");
            theSet[DicomTags.SamplesPerPixel].SetStringValue("1");
            theSet[DicomTags.PhotometricInterpretation].SetStringValue("MONOCHROME2");
            theSet[DicomTags.Rows].SetStringValue("256");
            theSet[DicomTags.Columns].SetStringValue("256");
            theSet[DicomTags.PixelSpacing].SetStringValue("1.367188\\1.367188");
            theSet[DicomTags.BitsAllocated].SetStringValue("16");
            theSet[DicomTags.BitsStored].SetStringValue("12");
            theSet[DicomTags.HighBit].SetStringValue("11");
            theSet[DicomTags.PixelRepresentation].SetStringValue("0");
            theSet[DicomTags.WindowCenter].SetStringValue("238");
            theSet[DicomTags.WindowWidth].SetStringValue("471");
            theSet[DicomTags.RescaleSlope].SetStringValue("1.1234567890123");
            theSet[DicomTags.RescaleIntercept].SetStringValue("0.0123456789012");

            uint length = 256 * 256 * 2;

            DicomAttributeOW pixels = new DicomAttributeOW(DicomTags.PixelData);

            byte[] pixelArray = new byte[length];

            for (uint i = 0; i < length; i += 2)
            {
                pixelArray[i] = (byte)(i % 255);
            }

            pixels.Values = pixelArray;

            theSet[DicomTags.PixelData] = pixels;

            DicomSequenceItem item = new DicomSequenceItem();

            theSet[DicomTags.RequestAttributesSequence].AddSequenceItem(item);

            item[DicomTags.RequestedProcedureId].SetStringValue("MRR1234");
            item[DicomTags.ScheduledProcedureStepId].SetStringValue("MRS1234");

            item = new DicomSequenceItem();
            theSet[DicomTags.RequestAttributesSequence].AddSequenceItem(item);

            item[DicomTags.RequestedProcedureId].SetStringValue("MR2R1234");
            item[DicomTags.ScheduledProcedureStepId].SetStringValue("MR2S1234");

            DicomSequenceItem studyItem = new DicomSequenceItem();

            item[DicomTags.ReferencedStudySequence].AddSequenceItem(studyItem);

            studyItem[DicomTags.ReferencedSopClassUid].SetStringValue(SopClass.MrImageStorageUid);
            studyItem[DicomTags.ReferencedSopInstanceUid].SetStringValue("1.2.3.4.5.6.7.8.9");
        }
コード例 #37
0
		/// <summary>
		/// Initializes a new instance of the <see cref="MrDiffusionFunctionalGroup"/> class.
		/// </summary>
		/// <param name="dicomSequenceItem">The DICOM sequence item.</param>
		public MrDiffusionFunctionalGroup(DicomSequenceItem dicomSequenceItem)
			: base(dicomSequenceItem) {}
コード例 #38
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReferencedSeriesSequenceItem"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The dicom sequence item.</param>
 public ReferencedSeriesSequenceItem(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem)
 {
 }
コード例 #39
0
ファイル: SoftcopyVoiLut.cs プロジェクト: khaha2210/radio
			/// <summary>
			/// Initializes a new instance of the <see cref="SoftcopyVoiLutSequenceItem"/> class.
			/// </summary>
			/// <param name="dicomSequenceItem">The dicom sequence item.</param>
			public SoftcopyVoiLutSequenceItem(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem) { }
コード例 #40
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PresentationStateRelationshipMacro"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The dicom sequence item.</param>
 public PresentationStateRelationshipMacro(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem)
 {
 }
コード例 #41
0
		/// <summary>
		/// Initializes a new instance of the <see cref="PlaneOrientationVolumeFunctionalGroup"/> class.
		/// </summary>
		/// <param name="dicomSequenceItem">The DICOM sequence item.</param>
		public PlaneOrientationVolumeFunctionalGroup(DicomSequenceItem dicomSequenceItem)
			: base(dicomSequenceItem) {}
コード例 #42
0
        private void SetupPrivateGroups(List <DicomTag> tagList, DicomAttributeCollection dataSet)
        {
            DicomTag privateCreatorTag = new DicomTag(0x00090010, "PrivateCreator", "PrivateCreator", DicomVr.LOvr, false, 1, 1,
                                                      false);

            dataSet[privateCreatorTag].SetStringValue("ClearCanvasGroup9");

            DicomTag privateTagFL = new DicomTag(0x00091020, "PrivateFL", "PrivateFL", DicomVr.FLvr, true, 1, 10, false);
            DicomTag privateTagLO = new DicomTag(0x00091021, "PrivateLO", "PrivateLO", DicomVr.LOvr, true, 1, 10, false);
            DicomTag privateTagAE = new DicomTag(0x00091022, "PrivateAE", "PrivateAE", DicomVr.AEvr, true, 1, 10, false);
            DicomTag privateTagAS = new DicomTag(0x00091023, "PrivateAS", "PrivateAS", DicomVr.ASvr, true, 1, 10, false);
            DicomTag privateTagAT = new DicomTag(0x00091024, "PrivateAT", "PrivateAT", DicomVr.ATvr, true, 1, 10, false);
            DicomTag privateTagCS = new DicomTag(0x00091025, "PrivateCS", "PrivateCS", DicomVr.CSvr, true, 1, 10, false);
            DicomTag privateTagDA = new DicomTag(0x00091026, "PrivateDA", "PrivateDA", DicomVr.DAvr, true, 1, 10, false);
            DicomTag privateTagDS = new DicomTag(0x00091027, "PrivateDS", "PrivateDS", DicomVr.DSvr, true, 1, 10, false);
            DicomTag privateTagDT = new DicomTag(0x00091028, "PrivateDT", "PrivateDT", DicomVr.DTvr, true, 1, 10, false);
            DicomTag privateTagFD = new DicomTag(0x00091029, "PrivateFD", "PrivateFD", DicomVr.FDvr, true, 1, 10, false);
            DicomTag privateTagIS = new DicomTag(0x00091030, "PrivateIS", "PrivateIS", DicomVr.ISvr, true, 1, 10, false);
            DicomTag privateTagLT = new DicomTag(0x00091031, "PrivateLT", "PrivateLT", DicomVr.LTvr, true, 1, 1, false);
            DicomTag privateTagOB = new DicomTag(0x00091032, "PrivateOB", "PrivateOB", DicomVr.OBvr, true, 1, 1, false);
            DicomTag privateTagOF = new DicomTag(0x00091033, "PrivateOF", "PrivateOF", DicomVr.OFvr, true, 1, 1, false);
            DicomTag privateTagOW = new DicomTag(0x00091034, "PrivateOW", "PrivateOW", DicomVr.OWvr, true, 1, 1, false);
            DicomTag privateTagPN = new DicomTag(0x00091035, "PrivatePN", "PrivatePN", DicomVr.PNvr, true, 1, 10, false);
            DicomTag privateTagSH = new DicomTag(0x00091036, "PrivateSH", "PrivateSH", DicomVr.SHvr, true, 1, 10, false);
            DicomTag privateTagSL = new DicomTag(0x00091037, "PrivateSL", "PrivateSL", DicomVr.SLvr, true, 1, 10, false);
            DicomTag privateTagSQ = new DicomTag(0x00091038, "PrivateSQ", "PrivateSQ", DicomVr.SQvr, true, 1, 10, false);
            DicomTag privateTagSS = new DicomTag(0x00091039, "PrivateSS", "PrivateSS", DicomVr.SSvr, true, 1, 10, false);
            DicomTag privateTagST = new DicomTag(0x00091040, "PrivateST", "PrivateST", DicomVr.STvr, true, 1, 10, false);
            DicomTag privateTagTM = new DicomTag(0x00091041, "PrivateTM", "PrivateTM", DicomVr.TMvr, true, 1, 10, false);
            DicomTag privateTagUI = new DicomTag(0x00091042, "PrivateUI", "PrivateUI", DicomVr.UIvr, true, 1, 10, false);
            DicomTag privateTagUL = new DicomTag(0x00091043, "PrivateUI", "PrivateUI", DicomVr.ULvr, true, 1, 10, false);
            DicomTag privateTagUS = new DicomTag(0x00091044, "PrivateUS", "PrivateUS", DicomVr.USvr, true, 1, 10, false);
            DicomTag privateTagUT = new DicomTag(0x00091045, "PrivateUT", "PrivateUT", DicomVr.UTvr, true, 1, 1, false);


            dataSet[privateTagFL].AppendFloat32(1.1f);
            dataSet[privateTagFL].AppendFloat32(1.1123132f);
            tagList.Add(privateTagFL);
            dataSet[privateTagLO].AppendString("Test");
            dataSet[privateTagLO].AppendString("Test Me 2");
            tagList.Add(privateTagLO);
            dataSet[privateTagAE].AppendString("TESTAE1");
            dataSet[privateTagAE].AppendString("TESTAE2");
            tagList.Add(privateTagAE);
            dataSet[privateTagAS].AppendString("003Y");
            dataSet[privateTagAS].AppendString("003D");
            tagList.Add(privateTagAS);
            dataSet[privateTagAT].AppendUInt32(DicomTags.ZoomFactor);
            dataSet[privateTagAT].AppendUInt32(DicomTags.PhotometricInterpretation);
            tagList.Add(privateTagAT);
            dataSet[privateTagCS].AppendString("CODE1");
            dataSet[privateTagCS].AppendString("CODE2");
            tagList.Add(privateTagCS);
            dataSet[privateTagDA].AppendDateTime(DateTime.Now);
            dataSet[privateTagDA].AppendDateTime(DateTime.Now);
            tagList.Add(privateTagDA);
            dataSet[privateTagDS].AppendFloat64(1.12351234124124f);
            dataSet[privateTagDS].AppendFloat64(-12312312312.1231f);
            tagList.Add(privateTagDS);
            dataSet[privateTagDT].AppendDateTime(DateTime.Now);
            dataSet[privateTagDT].AppendDateTime(DateTime.Now);
            tagList.Add(privateTagDT);
            dataSet[privateTagFD].AppendFloat64(1.112312d);
            dataSet[privateTagFD].AppendFloat64(-11123.13211d);
            tagList.Add(privateTagFD);
            dataSet[privateTagIS].AppendString("123456789");
            dataSet[privateTagIS].AppendString("123456789876");
            tagList.Add(privateTagIS);
            dataSet[privateTagLT].SetStringValue("Now is the time for all good men to come to the aide of their country.");
            tagList.Add(privateTagLT);
            dataSet[privateTagPN].AppendString("Last^First^Middle^Post");
            dataSet[privateTagPN].AppendString("W^Steven^R^Test");
            tagList.Add(privateTagPN);
            dataSet[privateTagST].SetStringValue("Now is the time for all good men to come to the aide of their country.");
            tagList.Add(privateTagST);
            dataSet[privateTagSH].AppendString("Short text 1");
            dataSet[privateTagSH].AppendString("Short text 2");
            dataSet[privateTagSH].AppendString("Short text 3");
            dataSet[privateTagSH].AppendString("Short text 4");
            tagList.Add(privateTagSH);
            dataSet[privateTagSL].AppendInt32(1024);
            dataSet[privateTagSL].AppendInt32(2048);
            dataSet[privateTagSL].AppendInt32(4096);
            dataSet[privateTagSL].AppendInt32(8192);
            dataSet[privateTagSL].AppendInt32(-1024);
            dataSet[privateTagSL].AppendInt32(-2048);
            dataSet[privateTagSL].AppendInt32(-4096);
            dataSet[privateTagSL].AppendInt32(-8192);
            tagList.Add(privateTagSL);
            dataSet[privateTagSS].AppendInt16(-1024);
            dataSet[privateTagSS].AppendInt16(512);
            dataSet[privateTagSS].AppendInt16(-256);
            dataSet[privateTagSS].AppendInt16(128);
            tagList.Add(privateTagSS);
            dataSet[privateTagTM].AppendDateTime(DateTime.Now);
            dataSet[privateTagTM].AppendDateTime(DateTime.Now);
            tagList.Add(privateTagTM);
            dataSet[privateTagUI].AppendUid(DicomUid.GenerateUid());
            dataSet[privateTagUI].AppendUid(DicomUid.GenerateUid());
            dataSet[privateTagUI].AppendUid(DicomUid.GenerateUid());
            dataSet[privateTagUI].AppendUid(DicomUid.GenerateUid());
            dataSet[privateTagUI].AppendUid(DicomUid.GenerateUid());
            dataSet[privateTagUI].AppendUid(DicomUid.GenerateUid());
            tagList.Add(privateTagUI);
            dataSet[privateTagUL].AppendUInt32(128);
            dataSet[privateTagUL].AppendUInt32(1024);
            dataSet[privateTagUL].AppendUInt32(16384);
            dataSet[privateTagUL].AppendUInt32(123123123);
            tagList.Add(privateTagUL);
            dataSet[privateTagUS].AppendUInt16(128);
            dataSet[privateTagUS].AppendUInt16(64);
            dataSet[privateTagUS].AppendUInt16(256);
            tagList.Add(privateTagUS);
            dataSet[privateTagUT].SetStringValue("A man, a plan, a canal, panama.");
            tagList.Add(privateTagUT);

            dataSet[privateTagOB].Values = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
            tagList.Add(privateTagOB);

            dataSet[privateTagOW].Values = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
            tagList.Add(privateTagOW);

            dataSet[privateTagOF].Values = new[] { 1.1111f, 2.222f, 3.3333f, 44444.444f, 5555.555f, 66666.66666f, 123123.123123f };
            tagList.Add(privateTagOF);


            DicomSequenceItem item = new DicomSequenceItem();

            item[DicomTags.PhotometricInterpretation].AppendString("MONOCHROME1");
            item[DicomTags.Rows].AppendUInt16(256);
            item[DicomTags.Columns].AppendUInt16(256);
            item[DicomTags.BitsAllocated].AppendUInt16(8);
            item[DicomTags.BitsStored].AppendUInt16(8);
            item[DicomTags.HighBit].AppendUInt16(7);
            item[DicomTags.PixelData].Values = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
            dataSet[privateTagSQ].AddSequenceItem(item);
            // SQ Attribute UN parsing does not work right now, don't add to the list.
            //tagList.Add(privateTagSQ);
        }
コード例 #43
0
		/// <summary>
		/// Initializes a new instance of the <see cref="DerivationImageFunctionalGroup"/> class.
		/// </summary>
		/// <param name="dicomSequenceItem">The DICOM sequence item.</param>
		public DerivationImageFunctionalGroup(DicomSequenceItem dicomSequenceItem)
			: base(dicomSequenceItem) {}
コード例 #44
0
        public void SQUNTests()
        {
            uint     fakeTag   = 0x00880199; // IconImageSequence is 0x00880200
            DicomTag fakeSQTag = new DicomTag(fakeTag, "Fake Icon", "FakeIcon", DicomVr.SQvr, false, 1, 1, false);

            if (DicomTagDictionary.TagDictionary.ContainsKey(fakeTag))
            {
                DicomTagDictionary.TagDictionary.Remove(fakeTag);
            }
            DicomTagDictionary.TagDictionary.Add(fakeTag, fakeSQTag);

            DicomFile file = new DicomFile("SQUNTest.dcm");
            DicomAttributeCollection dataSet = file.DataSet;

            SetupMetaInfo(file);
            SetupMR(dataSet);

            DicomSequenceItem item = new DicomSequenceItem();

            item[DicomTags.PhotometricInterpretation].AppendString("MONOCHROME1");
            item[DicomTags.Rows].AppendUInt16(4);
            item[DicomTags.Columns].AppendUInt16(4);
            item[DicomTags.BitsAllocated].AppendUInt16(8);
            item[DicomTags.BitsStored].AppendUInt16(8);
            item[DicomTags.HighBit].AppendUInt16(7);
            item[DicomTags.PixelData].Values = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10 };
            dataSet[fakeSQTag].AddSequenceItem(item);

            // Save the file
            DicomFile originalFile = new DicomFile("", file.MetaInfo.Copy(), file.DataSet.Copy());

            DicomTagDictionary.TagDictionary.Remove(fakeTag);

            List <DicomAttributeComparisonResult> results = new List <DicomAttributeComparisonResult>();
            bool             compare;
            DicomReadOptions readOptions = DicomReadOptions.Default;



            // Little Endian Tests
            file.TransferSyntax = TransferSyntax.ImplicitVrLittleEndian;

            // Implicit Little Endian, No tag in the Dictionary, Explicit Length SQ
            Assert.IsTrue(file.Save(DicomWriteOptions.ExplicitLengthSequence), "UN File Save");
            DicomFile newFile = new DicomFile(file.Filename);

            newFile.Load(readOptions);
            Assert.AreNotEqual(originalFile.DataSet.Equals(newFile.DataSet), true);
            DicomFile saveUNfile = newFile;

            // Implicit Little Endian, No tag in the Dictionary, Implicit Length SQ
            // Parser knows its a SQ from implicit length SQ
            Assert.IsTrue(file.Save(DicomWriteOptions.ExplicitLengthSequenceItem), "UN File Save");
            newFile = new DicomFile(file.Filename);
            newFile.Load(readOptions);
            results = new List <DicomAttributeComparisonResult>();
            compare = originalFile.DataSet.Equals(newFile.DataSet, ref results);
            Assert.IsTrue(compare, results.Count > 0 ? CollectionUtils.FirstElement(results).Details : string.Empty);


            // Implicit Little Endian, No tag in the Dictionary, Implicit Length SQ
            // Parser knows its a SQ from implicit length SQ
            Assert.IsTrue(file.Save(DicomWriteOptions.None), "UN File Save");
            newFile = new DicomFile(file.Filename);
            newFile.Load(readOptions);
            results = new List <DicomAttributeComparisonResult>();
            compare = originalFile.DataSet.Equals(newFile.DataSet, ref results);
            Assert.IsTrue(compare, results.Count > 0 ? CollectionUtils.FirstElement(results).Details : string.Empty);


            file = saveUNfile;
            file.TransferSyntax = TransferSyntax.ExplicitVrLittleEndian;

            // Explicit Little Endian, No tag in the dictionary, UN SQ
            // Parser keeps tag as UN
            Assert.IsTrue(file.Save(DicomWriteOptions.None), "UN File Save");
            newFile = new DicomFile(file.Filename);
            newFile.Load(readOptions);
            results = new List <DicomAttributeComparisonResult>();
            compare = file.DataSet.Equals(newFile.DataSet, ref results);
            Assert.IsTrue(compare, results.Count > 0 ? CollectionUtils.FirstElement(results).Details : string.Empty);
            Assert.AreNotEqual(originalFile.DataSet.Equals(newFile.DataSet), true);


            file.TransferSyntax = TransferSyntax.ExplicitVrBigEndian;

            // Explicit Big Endian, No tag in the dictionary, UN SQ
            // Parser keeps tag as UN
            Assert.IsTrue(file.Save(DicomWriteOptions.None), "UN File Save");
            newFile = new DicomFile(file.Filename);
            newFile.Load(readOptions);
            results = new List <DicomAttributeComparisonResult>();
            compare = file.DataSet.Equals(newFile.DataSet, ref results);
            Assert.IsTrue(compare, results.Count > 0 ? CollectionUtils.FirstElement(results).Details : string.Empty);
            Assert.AreNotEqual(originalFile.DataSet.Equals(newFile.DataSet), true);


            // Now add the tag into thedictionary
            DicomTagDictionary.TagDictionary.Add(fakeTag, fakeSQTag);
            file.TransferSyntax = TransferSyntax.ExplicitVrLittleEndian;

            // Note, if we add parsing of SQ UN tags, the result of this test would change
            // Explicit Little Endian, Tag in the dictionary, UN SQ
            // Parser keeps tag as UN
            Assert.IsTrue(file.Save(DicomWriteOptions.None), "UN File Save");
            newFile = new DicomFile(file.Filename);
            newFile.Load(readOptions);
            results = new List <DicomAttributeComparisonResult>();
            compare = file.DataSet.Equals(newFile.DataSet, ref results);
            Assert.IsTrue(compare, results.Count > 0 ? CollectionUtils.FirstElement(results).Details : string.Empty);
            Assert.AreNotEqual(originalFile.DataSet.Equals(newFile.DataSet), true);


            file.TransferSyntax = TransferSyntax.ExplicitVrBigEndian;

            // Note, if we add parsing of SQ UN tags, the result of this test would change
            // Explicit Big Endian, Tag in the dictionary, UN SQ
            // Parser keeps tag as UN
            Assert.IsTrue(file.Save(DicomWriteOptions.None), "UN File Save");
            newFile = new DicomFile(file.Filename);
            newFile.Load(readOptions);
            results = new List <DicomAttributeComparisonResult>();
            compare = file.DataSet.Equals(newFile.DataSet, ref results);
            Assert.IsTrue(compare, results.Count > 0 ? CollectionUtils.FirstElement(results).Details : string.Empty);
            Assert.AreNotEqual(originalFile.DataSet.Equals(newFile.DataSet), true);
        }
コード例 #45
0
		/// <summary>
		/// Creates the value of ReferencedSopSequence in the underlying collection. Type 1.
		/// </summary>
		IReferencedSopSequence IImageReferenceMacro.CreateReferencedSopSequence() {
			DicomAttribute dicomAttribute = base.DicomAttributeProvider[DicomTags.ReferencedSopSequence];
			if (dicomAttribute.IsNull || dicomAttribute.Count == 0) {
				DicomSequenceItem dicomSequenceItem = new DicomSequenceItem();
				dicomAttribute.Values = new DicomSequenceItem[] { dicomSequenceItem };
				ImageReferenceMacro.ReferencedSopSequenceType iodBase = new ImageReferenceMacro.ReferencedSopSequenceType(dicomSequenceItem);
				iodBase.InitializeAttributes();
				return iodBase;
			}
			return new ImageReferenceMacro.ReferencedSopSequenceType(((DicomSequenceItem[])dicomAttribute.Values)[0]);
		}
コード例 #46
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SegmentedPropertyTypeCodeSequenceItem"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The dicom sequence item.</param>
 public SegmentedPropertyTypeCodeSequenceItem(DicomSequenceItem dicomSequenceItem)
     : base(dicomSequenceItem)
 {
 }
コード例 #47
0
ファイル: StudyXmlTests.cs プロジェクト: khaha2210/radio
		private List<DicomFile> SetupImagesWithVoiLutSequenceA(int number)
		{
			List<DicomFile> images = SetupImages(number);

			for (int i = 0; i < images.Count; ++i)
			{
				DicomSequenceItem item = new DicomSequenceItem();
				images[i].DataSet[DicomTags.VoiLutSequence].AddSequenceItem(item);

				item[DicomTags.LutDescriptor].SetStringValue(@"16384\0\16");
				item[DicomTags.LutExplanation].SetStringValue("NORMAL");
				item[DicomTags.LutData].Values = GetLutData(1);

				item = new DicomSequenceItem();
				images[i].DataSet[DicomTags.VoiLutSequence].AddSequenceItem(item);

				item[DicomTags.LutDescriptor].SetStringValue(@"16384\0\16");
				item[DicomTags.LutExplanation].SetStringValue("HARDER");
				item[DicomTags.LutData].Values = GetLutData(2);

				item = new DicomSequenceItem();
				images[i].DataSet[DicomTags.VoiLutSequence].AddSequenceItem(item);

				item[DicomTags.LutDescriptor].SetStringValue(@"16384\0\16");
				item[DicomTags.LutExplanation].SetStringValue("SOFTER");
				item[DicomTags.LutData].Values = GetLutData(3);
			}

			return images;
		}
コード例 #48
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SegmentSequence"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The dicom sequence item.</param>
 public SegmentSequence(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem)
 {
 }
		/// <summary>
		/// Initializes a new instance of the <see cref="CalibrationSequenceItem"/> class.
		/// </summary>
		/// <param name="dicomSequenceItem">The DICOM sequence item.</param>
		public CalibrationSequenceItem(DicomSequenceItem dicomSequenceItem)
			: base(dicomSequenceItem) {}
コード例 #50
0
ファイル: UnknowVrTests.cs プロジェクト: scottshea/monodicom
        public void PrivateAttributeTest()
        {
            DicomFile file = new DicomFile("LittleEndianPrivateReadFileTest.dcm");

            DicomAttributeCollection dataSet = file.DataSet;

            SetupMR(dataSet);

            DicomTag privateCreatorTag = new DicomTag(0x00090010, "PrivateCreator", "PrivateCreator", DicomVr.LOvr, false, 1, 1,
                                                      false);

            dataSet[privateCreatorTag].SetStringValue("ClearCanvasGroup9");

            DicomTag privateTagFL = new DicomTag(0x00091020, "PrivateFL", "PrivateFL", DicomVr.FLvr, true, 1, 10, false);
            DicomTag privateTagLO = new DicomTag(0x00091021, "PrivateLO", "PrivateLO", DicomVr.LOvr, true, 1, 10, false);
            DicomTag privateTagAE = new DicomTag(0x00091022, "PrivateAE", "PrivateAE", DicomVr.AEvr, true, 1, 10, false);
            DicomTag privateTagAS = new DicomTag(0x00091023, "PrivateAS", "PrivateAS", DicomVr.ASvr, true, 1, 10, false);
            DicomTag privateTagAT = new DicomTag(0x00091024, "PrivateAT", "PrivateAT", DicomVr.ATvr, true, 1, 10, false);
            DicomTag privateTagCS = new DicomTag(0x00091025, "PrivateCS", "PrivateCS", DicomVr.CSvr, true, 1, 10, false);
            DicomTag privateTagDA = new DicomTag(0x00091026, "PrivateDA", "PrivateDA", DicomVr.DAvr, true, 1, 10, false);
            DicomTag privateTagDS = new DicomTag(0x00091027, "PrivateDS", "PrivateDS", DicomVr.DSvr, true, 1, 10, false);
            DicomTag privateTagDT = new DicomTag(0x00091028, "PrivateDT", "PrivateDT", DicomVr.DTvr, true, 1, 10, false);
            DicomTag privateTagFD = new DicomTag(0x00091029, "PrivateFD", "PrivateFD", DicomVr.FDvr, true, 1, 10, false);
            DicomTag privateTagIS = new DicomTag(0x00091030, "PrivateIS", "PrivateIS", DicomVr.ISvr, true, 1, 10, false);
            DicomTag privateTagLT = new DicomTag(0x00091031, "PrivateLT", "PrivateLT", DicomVr.LTvr, true, 1, 1, false);
            DicomTag privateTagOB = new DicomTag(0x00091032, "PrivateOB", "PrivateOB", DicomVr.OBvr, true, 1, 1, false);
            DicomTag privateTagOF = new DicomTag(0x00091033, "PrivateOF", "PrivateOF", DicomVr.OFvr, true, 1, 1, false);
            DicomTag privateTagOW = new DicomTag(0x00091034, "PrivateOW", "PrivateOW", DicomVr.OWvr, true, 1, 1, false);
            DicomTag privateTagPN = new DicomTag(0x00091035, "PrivatePN", "PrivatePN", DicomVr.PNvr, true, 1, 10, false);
            DicomTag privateTagSH = new DicomTag(0x00091036, "PrivateSH", "PrivateSH", DicomVr.SHvr, true, 1, 10, false);
            DicomTag privateTagSL = new DicomTag(0x00091037, "PrivateSL", "PrivateSL", DicomVr.SLvr, true, 1, 10, false);
            DicomTag privateTagSQ = new DicomTag(0x00091038, "PrivateSQ", "PrivateSQ", DicomVr.SQvr, true, 1, 10, false);
            DicomTag privateTagSS = new DicomTag(0x00091039, "PrivateSS", "PrivateSS", DicomVr.SSvr, true, 1, 10, false);
            DicomTag privateTagST = new DicomTag(0x00091040, "PrivateST", "PrivateST", DicomVr.STvr, true, 1, 10, false);
            DicomTag privateTagTM = new DicomTag(0x00091041, "PrivateTM", "PrivateTM", DicomVr.TMvr, true, 1, 10, false);
            DicomTag privateTagUI = new DicomTag(0x00091042, "PrivateUI", "PrivateUI", DicomVr.UIvr, true, 1, 10, false);
            DicomTag privateTagUL = new DicomTag(0x00091043, "PrivateUI", "PrivateUI", DicomVr.ULvr, true, 1, 10, false);
            DicomTag privateTagUS = new DicomTag(0x00091044, "PrivateUS", "PrivateUS", DicomVr.USvr, true, 1, 10, false);
            DicomTag privateTagUT = new DicomTag(0x00091045, "PrivateUT", "PrivateUT", DicomVr.UTvr, true, 1, 1, false);

            List <DicomTag> tagList = new List <DicomTag>();


            dataSet[privateTagFL].AppendFloat32(1.1f);
            dataSet[privateTagFL].AppendFloat32(1.1123132f);
            tagList.Add(privateTagFL);
            dataSet[privateTagLO].AppendString("Test");
            dataSet[privateTagLO].AppendString("Test Me 2");
            tagList.Add(privateTagLO);
            dataSet[privateTagAE].AppendString("TESTAE1");
            dataSet[privateTagAE].AppendString("TESTAE2");
            tagList.Add(privateTagAE);
            dataSet[privateTagAS].AppendString("003Y");
            dataSet[privateTagAS].AppendString("003D");
            tagList.Add(privateTagAS);
            dataSet[privateTagAT].AppendUInt32(DicomTags.ZoomFactor);
            dataSet[privateTagAT].AppendUInt32(DicomTags.PhotometricInterpretation);
            tagList.Add(privateTagAT);
            dataSet[privateTagCS].AppendString("CODE1");
            dataSet[privateTagCS].AppendString("CODE2");
            tagList.Add(privateTagCS);
            dataSet[privateTagDA].AppendDateTime(DateTime.Now);
            dataSet[privateTagDA].AppendDateTime(DateTime.Now);
            tagList.Add(privateTagDA);
            dataSet[privateTagDS].AppendFloat64(1.12351234124124f);
            dataSet[privateTagDS].AppendFloat64(-12312312312.1231f);
            tagList.Add(privateTagDS);
            dataSet[privateTagDT].AppendDateTime(DateTime.Now);
            dataSet[privateTagDT].AppendDateTime(DateTime.Now);
            tagList.Add(privateTagDT);
            dataSet[privateTagFD].AppendFloat64(1.112312d);
            dataSet[privateTagFD].AppendFloat64(-11123.13211d);
            tagList.Add(privateTagFD);
            dataSet[privateTagIS].AppendString("123456789");
            dataSet[privateTagIS].AppendString("123456789876");
            tagList.Add(privateTagIS);
            dataSet[privateTagLT].SetStringValue("Now is the time for all good men to come to the aide of their country.");
            tagList.Add(privateTagLT);
            dataSet[privateTagPN].AppendString("Last^First^Middle^Post");
            dataSet[privateTagPN].AppendString("W^Steven^R^Test");
            tagList.Add(privateTagPN);
            dataSet[privateTagST].SetStringValue("Now is the time for all good men to come to the aide of their country.");
            tagList.Add(privateTagST);
            dataSet[privateTagSH].AppendString("Short text 1");
            dataSet[privateTagSH].AppendString("Short text 2");
            dataSet[privateTagSH].AppendString("Short text 3");
            dataSet[privateTagSH].AppendString("Short text 4");
            tagList.Add(privateTagSH);
            dataSet[privateTagSL].AppendInt32(1024);
            dataSet[privateTagSL].AppendInt32(2048);
            dataSet[privateTagSL].AppendInt32(4096);
            dataSet[privateTagSL].AppendInt32(8192);
            dataSet[privateTagSL].AppendInt32(-1024);
            dataSet[privateTagSL].AppendInt32(-2048);
            dataSet[privateTagSL].AppendInt32(-4096);
            dataSet[privateTagSL].AppendInt32(-8192);
            tagList.Add(privateTagSL);
            dataSet[privateTagSS].AppendInt16(-1024);
            dataSet[privateTagSS].AppendInt16(512);
            dataSet[privateTagSS].AppendInt16(-256);
            dataSet[privateTagSS].AppendInt16(128);
            tagList.Add(privateTagSS);
            dataSet[privateTagTM].AppendDateTime(DateTime.Now);
            dataSet[privateTagTM].AppendDateTime(DateTime.Now);
            tagList.Add(privateTagTM);
            dataSet[privateTagUI].AppendUid(DicomUid.GenerateUid());
            dataSet[privateTagUI].AppendUid(DicomUid.GenerateUid());
            dataSet[privateTagUI].AppendUid(DicomUid.GenerateUid());
            dataSet[privateTagUI].AppendUid(DicomUid.GenerateUid());
            dataSet[privateTagUI].AppendUid(DicomUid.GenerateUid());
            dataSet[privateTagUI].AppendUid(DicomUid.GenerateUid());
            tagList.Add(privateTagUI);
            dataSet[privateTagUL].AppendUInt32(128);
            dataSet[privateTagUL].AppendUInt32(1024);
            dataSet[privateTagUL].AppendUInt32(16384);
            dataSet[privateTagUL].AppendUInt32(123123123);
            tagList.Add(privateTagUL);
            dataSet[privateTagUS].AppendUInt16(128);
            dataSet[privateTagUS].AppendUInt16(64);
            dataSet[privateTagUS].AppendUInt16(256);
            tagList.Add(privateTagUS);
            dataSet[privateTagUT].SetStringValue("A man, a plan, a canal, panama.");
            tagList.Add(privateTagUT);

            dataSet[privateTagOB].Values = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
            tagList.Add(privateTagOB);

            dataSet[privateTagOW].Values = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
            tagList.Add(privateTagOW);

            dataSet[privateTagOF].Values = new[] { 1.1111f, 2.222f, 3.3333f, 44444.444f, 5555.555f, 66666.66666f, 123123.123123f };
            tagList.Add(privateTagOF);


            DicomSequenceItem item = new DicomSequenceItem();

            item[DicomTags.PhotometricInterpretation].AppendString("MONOCHROME1");
            item[DicomTags.Rows].AppendUInt16(256);
            item[DicomTags.Columns].AppendUInt16(256);
            item[DicomTags.BitsAllocated].AppendUInt16(8);
            item[DicomTags.BitsStored].AppendUInt16(8);
            item[DicomTags.HighBit].AppendUInt16(7);
            dataSet[privateTagSQ].AddSequenceItem(item);
            // SQ Attribute UN parsing does not work right now, don't add to the list.
            //tagList.Add(privateTagSQ);

            SetupMetaInfo(file);

            dataSet[DicomTags.StudyDescription].SetNullValue();

            // Little Endian Tests
            file.TransferSyntax = TransferSyntax.ImplicitVrLittleEndian;

            DicomReadOptions readOptions = DicomReadOptions.Default;

            // Use ExplicitLengthSequence to force SQ attributes to UN VR when they're ready back in
            bool result = file.Save(DicomWriteOptions.ExplicitLengthSequence);

            Assert.AreEqual(result, true);

            DicomFile newFile = new DicomFile(file.Filename);

            newFile.Load(readOptions);

            Assert.IsTrue(newFile.DataSet[DicomTags.StudyDescription].IsNull);

            Assert.AreNotEqual(file.DataSet.Equals(newFile.DataSet), true);

            foreach (DicomTag tag in tagList)
            {
                DicomAttributeUN unAttrib = newFile.DataSet[tag] as DicomAttributeUN;
                Assert.IsNotNull(unAttrib, String.Format("UN VR Attribute is not null for tag {0}", tag));

                ByteBuffer bb = unAttrib.GetByteBuffer(TransferSyntax.ImplicitVrLittleEndian,
                                                       newFile.DataSet[DicomTags.SpecificCharacterSet].ToString());
                Assert.IsNotNull(bb, String.Format("ByteBuffer not null for tag: {0}", tag));

                DicomAttribute validAttrib = tag.VR.CreateDicomAttribute(tag, bb);
                Assert.IsNotNull(validAttrib);

                Assert.IsTrue(validAttrib.Equals(file.DataSet[tag]), String.Format("Attributes equal for tag {0}", tag));
            }
        }
コード例 #51
0
		/// <summary>
		/// Initializes a new instance of the <see cref="ModalityLutMacro"/> class.
		/// </summary>
		/// <param name="dicomSequenceItem">The dicom sequence item.</param>
		public ModalityLutMacro(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem) {}
コード例 #52
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ContentItemMacro"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The dicom sequence item.</param>
 public ContentItemMacro(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem)
 {
 }
コード例 #53
0
		/// <summary>
		/// Initializes a new instance of the <see cref="HierarchicalSeriesInstanceReferenceMacro"/> class.
		/// </summary>
		/// <param name="dicomSequenceItem">The dicom sequence item.</param>
		public HierarchicalSeriesInstanceReferenceMacro(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem) {}
コード例 #54
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MrDiffusionSequenceItem"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The DICOM sequence item.</param>
 public MrDiffusionSequenceItem(DicomSequenceItem dicomSequenceItem)
     : base(dicomSequenceItem)
 {
 }
コード例 #55
0
		/// <summary>
		/// Initializes a new instance of the <see cref="PetFrameTypeFunctionalGroup"/> class.
		/// </summary>
		/// <param name="dicomSequenceItem">The DICOM sequence item.</param>
		public PetFrameTypeFunctionalGroup(DicomSequenceItem dicomSequenceItem)
			: base(dicomSequenceItem) {}
コード例 #56
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MrDiffusionFunctionalGroup"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The DICOM sequence item.</param>
 public MrDiffusionFunctionalGroup(DicomSequenceItem dicomSequenceItem)
     : base(dicomSequenceItem)
 {
 }
コード例 #57
0
			/// <summary>
			/// Initializes a new instance of the <see cref="TextObjectSequenceItem"/> class.
			/// </summary>
			/// <param name="dicomSequenceItem">The dicom sequence item.</param>
			public TextObjectSequenceItem(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem) {}
コード例 #58
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ModalityLutMacro"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The dicom sequence item.</param>
 public ModalityLutMacro(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem)
 {
 }
コード例 #59
0
			/// <summary>
			/// Initializes a new instance of the <see cref="GraphicObjectSequenceItem"/> class.
			/// </summary>
			/// <param name="dicomSequenceItem">The dicom sequence item.</param>
			public GraphicObjectSequenceItem(DicomSequenceItem dicomSequenceItem) : base(dicomSequenceItem) {}
コード例 #60
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IntravascularOctFrameTypeFunctionalGroup"/> class.
 /// </summary>
 /// <param name="dicomSequenceItem">The DICOM sequence item.</param>
 public IntravascularOctFrameTypeFunctionalGroup(DicomSequenceItem dicomSequenceItem)
     : base(dicomSequenceItem)
 {
 }