Example #1
0
 private static IEnumerable <ISopDataSource> CreateSopSeries(int sopCount,
                                                             string patientId, string patientName,
                                                             string studyId, string studyInstanceUid,
                                                             string seriesDesc, int seriesNumber, string seriesInstanceUid,
                                                             string frameOfReferenceUid, string modality,
                                                             SopClass sopClass, DicomDataSetInitializer initializer)
 {
     for (int n = 0; n < sopCount; n++)
     {
         var dicomFile = new DicomFile();
         var dataset   = dicomFile.DataSet;
         if (initializer != null)
         {
             initializer.Invoke(dataset);
         }
         dataset[DicomTags.PatientId].SetStringValue(patientId);
         dataset[DicomTags.PatientsName].SetStringValue(patientName);
         dataset[DicomTags.StudyId].SetStringValue(studyId);
         dataset[DicomTags.StudyInstanceUid].SetStringValue(studyInstanceUid);
         dataset[DicomTags.SeriesDescription].SetStringValue(seriesDesc);
         dataset[DicomTags.SeriesNumber].SetInt32(0, seriesNumber);
         dataset[DicomTags.SeriesInstanceUid].SetStringValue(seriesInstanceUid);
         dataset[DicomTags.SopInstanceUid].SetStringValue(DicomUid.GenerateUid().UID);
         dataset[DicomTags.SopClassUid].SetStringValue(sopClass.Uid);
         dataset[DicomTags.Modality].SetStringValue(modality.ToString());
         dataset[DicomTags.FrameOfReferenceUid].SetStringValue(frameOfReferenceUid);
         dataset[DicomTags.ImageOrientationPatient].SetStringValue(string.Format(@"{0}\{1}\{2}\{3}\{4}\{5}", 1, 0, 0, 0, 1, 0));
         dataset[DicomTags.ImagePositionPatient].SetStringValue(string.Format(@"{0}\{1}\{2}", 0, 0, n));
         dataset[DicomTags.PixelSpacing].SetStringValue(string.Format(@"{0}\{1}", 0.5, 0.5));
         dataset[DicomTags.PhotometricInterpretation].SetStringValue("MONOCHROME2");
         dataset[DicomTags.SamplesPerPixel].SetInt32(0, 1);
         dataset[DicomTags.BitsStored].SetInt32(0, 16);
         dataset[DicomTags.BitsAllocated].SetInt32(0, 16);
         dataset[DicomTags.HighBit].SetInt32(0, 15);
         dataset[DicomTags.PixelRepresentation].SetInt32(0, 1);
         dataset[DicomTags.Rows].SetInt32(0, 100);
         dataset[DicomTags.Columns].SetInt32(0, 100);
         dataset[DicomTags.WindowCenter].SetInt32(0, 0);
         dataset[DicomTags.WindowWidth].SetInt32(0, 65536);
         dataset[DicomTags.WindowCenterWidthExplanation].SetString(0, "Full Window");
         dataset[DicomTags.PixelData].Values  = new byte[2 * 100 * 100];
         dicomFile.MediaStorageSopClassUid    = dataset[DicomTags.SopClassUid];
         dicomFile.MediaStorageSopInstanceUid = dataset[DicomTags.SopInstanceUid];
         yield return(new XSopDataSource(dicomFile));
     }
 }
Example #2
0
 private static IEnumerable <ISopDataSource> CreateSopSeries(int sopCount, string patientId, string studyId, string seriesDesc, int seriesNumber, string frameOfReferenceId, string modality, SopClass sopClass, DicomDataSetInitializer initializer)
 {
     return(CreateSopSeries(sopCount, patientId, patientId, studyId, HashUid(studyId), seriesDesc, seriesNumber, HashUid(seriesDesc), HashUid(frameOfReferenceId), modality, sopClass, initializer));
 }