Example #1
0
        internal static void RegisterAllimage(String Path)
        {
            var response       = DicomFile.Open(Path);
            var SOPInstanceUID = response.Dataset.GetSingleValue <String>(DicomTag.SOPInstanceUID);
            int RowPositionInTotalImagePixelMatrix;
            int ColumnPositionInTotalImagePixelMatrix;
            int TotalPixelMatrixRows;
            int TotalPixelMatrixColumns;
            int Rows;
            int Columns;

            TotalPixelMatrixRows    = response.Dataset.GetSingleValue <int>(DicomTag.TotalPixelMatrixRows);
            TotalPixelMatrixColumns = response.Dataset.GetSingleValue <int>(DicomTag.TotalPixelMatrixColumns);
            Rows    = response.Dataset.GetSingleValue <int>(DicomTag.Rows);
            Columns = response.Dataset.GetSingleValue <int>(DicomTag.Columns);
            var           Level = 0;
            DicomSequence PerFrameFunctionalGroupsSequence = response.Dataset.GetSequence(DicomTag.PerFrameFunctionalGroupsSequence);

            if (PerFrameFunctionalGroupsSequence != null)
            {
                var PerFrameFunctionalGroupsItems = PerFrameFunctionalGroupsSequence.GetEnumerator();
                var FrameIndex = 0;
                while (PerFrameFunctionalGroupsItems.MoveNext())
                {
                    var PlanePositionSlideSequence = PerFrameFunctionalGroupsItems.Current.GetSequence(DicomTag.PlanePositionSlideSequence);

                    ColumnPositionInTotalImagePixelMatrix = PlanePositionSlideSequence.Items[0].GetSingleValue <int>(DicomTag.ColumnPositionInTotalImagePixelMatrix);
                    RowPositionInTotalImagePixelMatrix    = PlanePositionSlideSequence.Items[0].GetSingleValue <int>(DicomTag.RowPositionInTotalImagePixelMatrix);
                    DataManager.AddFrame(SOPInstanceUID, RowPositionInTotalImagePixelMatrix, ColumnPositionInTotalImagePixelMatrix, FrameIndex++);
                }
            }
            DataManager.AddImage(SOPInstanceUID, Rows, Columns, TotalPixelMatrixColumns, TotalPixelMatrixRows, Level);
        }
Example #2
0
        /// <summary>
        /// Get WSI Headers From NetWork,Send a CFind
        /// </summary>
        /// <param name="serieUid">SeriesUID ,also a WSI Classify</param>
        internal void RegisterAllimage(string serieUid)
        {
            request = CreateImageRequestBySeriesUID(serieUid);
            request.OnResponseReceived += (req, response) =>
            {
                if (response.Status == DicomStatus.Pending)
                {
                    var SOPInstanceUID = response.Dataset?.GetSingleValue <string>(DicomTag.SOPInstanceUID);
                    int RowPositionInTotalImagePixelMatrix;
                    int ColumnPositionInTotalImagePixelMatrix;
                    int TotalPixelMatrixRows;
                    int TotalPixelMatrixColumns;
                    int Rows;
                    int Columns;
                    TotalPixelMatrixRows    = response.Dataset.GetSingleValue <int>(DicomTag.TotalPixelMatrixRows);
                    TotalPixelMatrixColumns = response.Dataset.GetSingleValue <int>(DicomTag.TotalPixelMatrixColumns);
                    Rows    = response.Dataset.GetSingleValue <int>(DicomTag.Rows);
                    Columns = response.Dataset.GetSingleValue <int>(DicomTag.Columns);
                    var           Level = 0;
                    DicomSequence PerFrameFunctionalGroupsSequence = response.Dataset.GetSequence(DicomTag.PerFrameFunctionalGroupsSequence);
                    if (PerFrameFunctionalGroupsSequence != null)
                    {
                        var PerFrameFunctionalGroupsItems = PerFrameFunctionalGroupsSequence.GetEnumerator();
                        var FrameIndex = 0;
                        while (PerFrameFunctionalGroupsItems.MoveNext())
                        {
                            var PlanePositionSlideSequence = PerFrameFunctionalGroupsItems.Current.GetSequence(DicomTag.PlanePositionSlideSequence);

                            ColumnPositionInTotalImagePixelMatrix = PlanePositionSlideSequence.Items[0].GetSingleValue <int>(DicomTag.ColumnPositionInTotalImagePixelMatrix);
                            RowPositionInTotalImagePixelMatrix    = PlanePositionSlideSequence.Items[0].GetSingleValue <int>(DicomTag.RowPositionInTotalImagePixelMatrix);
                            DataManager.AddFrame(SOPInstanceUID, RowPositionInTotalImagePixelMatrix, ColumnPositionInTotalImagePixelMatrix, FrameIndex++);
                        }
                    }
                    DataManager.AddImage(SOPInstanceUID, Rows, Columns, TotalPixelMatrixColumns, TotalPixelMatrixRows, Level);
                }
                if (response.Status == DicomStatus.Success)
                {
                    DataManager.InitLevelInImage();
                }
            };

            client.AddRequest(request);
            client.SendAsync(QRServerHost, QRServerPort, false, AET, QRServerAET).Wait();
        }