//サムネイルの取得 public static void GetThumbnail(SeriesKey key, out byte[] thumb) { thumb = null; if (key.SOPInstanceUID == null) { string thumbFile = Path.Combine(server[Int32.Parse(key.StorageID)], key.StudyInstanceUID, key.SeriesInstanceUID, FILE_THUMB); if (File.Exists(thumbFile)) { thumb = File.ReadAllBytes(thumbFile); } else { LogUtil.Error("File Not Found: " + thumbFile); } } else { string dicomFile = Path.Combine(server[Int32.Parse(key.StorageID)], key.StudyInstanceUID, key.SeriesInstanceUID, key.SOPInstanceUID + EXT_DICOM); if (File.Exists(dicomFile)) { DicomUtil.DicomToThumb(dicomFile, out thumb); } else { LogUtil.Error("File Not Found: " + dicomFile); } } }
//サムネイルの取得 public static void GetThumbnail(SeriesKey key, out byte[] thumb) { thumb = null; var sto = DbCacheUtil.GetStorage(key.StorageID); using (var imp = new Impersonate(sto.LogonUsername, sto.LogonPassword)) { var dicomFile = FileUtil.GetDicomFile(key); if (File.Exists(dicomFile)) { DicomUtil.DicomToThumb(dicomFile, out thumb); } } }
//サムネイルの作成 public static void GetThumbnail(SeriesKey key, out byte[] thumb) { thumb = null; if (key.SOPInstanceUID == null || key.SOPInstanceUID == "") { using (var pc = new PacsComm()) { DicomTagsResult ret = pc.CFindImage(key.StudyInstanceUID, key.SeriesInstanceUID); if (!ret.IsSuccess) { LogUtil.Error("CFINDに失敗しました。"); return; } var tags = new List <Tuple <string, long> >(); foreach (var dcmTag in ret.Tags) { long InstanceNumber = 0; Int64.TryParse(dcmTag.GetTagValue(DicomDic.Find("InstanceNumber").Tag), out InstanceNumber); var tag = Tuple.Create(dcmTag.GetTagValue(DicomDic.Find("SOPInstanceUID").Tag), InstanceNumber); tags.Add(tag); } //ソート tags = tags.OrderBy(n => n.Item2).ToList(); if (tags.Count > 0) { key.SOPInstanceUID = tags[0].Item1; } } } if (key.SOPInstanceUID != null && key.SOPInstanceUID != "") { //DICOMがある { LCL.GetImageStorageID(ref key); if (key.StorageID != null && key.StorageID != "") { var sto = DbCacheUtil.GetStorage(key.StorageID); using (var imp = new Impersonate(sto.LogonUsername, sto.LogonPassword)) { var file = FileUtil.GetDicomFile(key); if (File.Exists(file)) { DicomUtil.DicomToThumb(file, out thumb); if (thumb != null) { return; } } } } } //DICOMがない using (var pc = new PacsComm()) { //画像取得 DicomFilesResult ret = pc.CMoveImage(key.StudyInstanceUID, key.SeriesInstanceUID, key.SOPInstanceUID); if (!ret.IsSuccess) { LogUtil.Error("CMoveImage"); return; } if (ret.Files.Length == 0) { LogUtil.Error("CMoveImage [File=0]"); return; } LogUtil.Debug1("CMoveImage [File={0}]", ret.Files.Length.ToString()); foreach (DicomFile dcmfile in ret.Files) { var file = dcmfile.FileName.Trim(); if (!File.Exists(file)) { continue; } DicomUtil.DicomToThumb(file, out thumb); if (thumb != null) { return; } } } } }