Example #1
0
        private void UpdateFromImages(PatientGroupViewModel patientGroupItem)
        {
            LocalImageResourceManagerClient cmsc1 =
                new LocalImageResourceManagerClient();

            var idcs = from guid in cmsc1.GetImageResourceIds(patientGroupItem.PatientId)
                       select cmsc1.GetImage(guid);

            var idcsList = idcs.Where(thisIdc => thisIdc != null).ToList();

            foreach (var idc in idcsList)
            {
                int volumeVoxels = 0;

                Dispatcher.Invoke(() =>
                                  ImageSelectionManager.AddOrUpdate <ImageSeriesViewModel>(
                                      _imageSelectionManager._series,
                                      s => s.SeriesInstanceUID.CompareTo(idc.SeriesInstanceUID) == 0,
                                      s =>
                {
                    s.InstanceCount++;
                    s.ResampleStatus =
                        (volumeVoxels > 0)
                                        ? string.Format("Resampled ({0} voxels)", volumeVoxels)
                                        : "<not resampled>";
                },
                                      () =>
                {
                    var isvm            = ImageSeriesViewModel.Create(idc);
                    isvm.ResampleStatus = (volumeVoxels > 0)
                                    ? string.Format("Resampled ({0} voxels)", volumeVoxels)
                                    : "<not resampled>";
                    return(isvm);
                }));
            }

            cmsc1.Close();
        }
Example #2
0
        private void UpdateFromSeries(PatientGroupViewModel patientGroupItem)
        {
            LocalImageResourceManagerClient cmsc1 =
                new LocalImageResourceManagerClient();

            var ivdcs = from guid in cmsc1.GetImageVolumeResourceIds(patientGroupItem.PatientId)
                        select cmsc1.GetImageVolume(guid);

            // force generation
            var ivdcsList = ivdcs.ToList();

            foreach (var ivdc in ivdcsList)
            {
                Dispatcher.Invoke(() =>
                                  ImageSelectionManager.AddOrUpdate <ImageSeriesViewModel>(
                                      _imageSelectionManager._series,
                                      s => s.SeriesInstanceUID.CompareTo(ivdc.Identity.SeriesInstanceUID) == 0,
                                      s =>
                {
                    s.ResampleStatus =
                        (ivdc != null)
                                        ? string.Format("Resampled ({0} slices)", ivdc.Depth)
                                        : "<not resampled>";
                },
                                      () =>
                {
                    var isvm            = ImageSeriesViewModel.Create(ivdc);
                    isvm.ResampleStatus = (ivdc != null)
                                    ? string.Format("Resampled ({0} slices)", ivdc.Depth)
                                    : "<not resampled>";
                    return(isvm);
                }));
            }

            cmsc1.Close();
        }
Example #3
0
        /// <summary>
        /// upon image stored, update the image series vm
        /// </summary>
        /// <param name="methodGuid"></param>
        /// <param name="imageGuid"></param>
        /// <param name="repoGb"></param>
        void ImageStoredResponse_ImageStoredEvent(string methodGuid, Guid imageGuid, double repoGb)
        {
            LocalImageResourceManagerClient imageResource = new LocalImageResourceManagerClient();

            try
            {
                var idc = imageResource.GetImage(imageGuid);

                // TODO: null happens because of orphaned events
                if (idc != null)
                {
                    _dispatcher.Invoke(() =>
                    {
                        AddOrUpdate(_patientGroups,
                                    pg => pg.PatientId.CompareTo(idc.PatientId) == 0,
                                    pg => pg.InstanceCount++,
                                    () => new PatientGroupViewModel(idc.PatientId));

                        ICollectionView pgv = CollectionViewSource.GetDefaultView(_patientGroups);
                        var pgvm            = (PatientGroupViewModel)pgv.CurrentItem;
                        if (pgvm != null &&
                            pgvm.PatientId.CompareTo(idc.PatientId) == 0)
                        {
                            AddOrUpdate <ImageSeriesViewModel>(_series,
                                                               s => s.SeriesInstanceUID.CompareTo(idc.SeriesInstanceUID) == 0,
                                                               s => s.InstanceCount++,
                                                               () => ImageSeriesViewModel.Create(idc));
                        }
                    });
                }
            }
            finally
            {
                imageResource.Close();
            }
        }