/// <summary>
 /// create for the series for an image volume
 /// </summary>
 /// <param name="ivdc">the image volume data contract</param>
 /// <returns>the new view model</returns>
 public static ImageSeriesViewModel Create(UniformImageVolumeDataContract ivdc)
 {
     var isvm = new ImageSeriesViewModel()
     {
         SeriesInstanceUID = ivdc.Identity.SeriesInstanceUID,
         FrameOfReferenceUID = ivdc.FrameOfReferenceUID,
         SeriesLabel = ivdc.Identity.Label,
     };
     return isvm;
 }
 /// <summary>
 /// create for the series containing a single image
 /// </summary>
 /// <param name="idc">the data contract for the image</param>
 /// <returns>the new view model</returns>
 public static ImageSeriesViewModel Create(ImageDataContract idc)
 {
     var isvm = new ImageSeriesViewModel()
     {
         SeriesInstanceUID = idc.SeriesInstanceUID,
         FrameOfReferenceUID = idc.FrameOfReferenceUID,
         SeriesLabel = idc.Label,
     };
     return isvm;
 }
Beispiel #3
0
        /// <summary>
        /// create for the series for an image volume
        /// </summary>
        /// <param name="ivdc">the image volume data contract</param>
        /// <returns>the new view model</returns>
        public static ImageSeriesViewModel Create(UniformImageVolumeDataContract ivdc)
        {
            var isvm = new ImageSeriesViewModel()
            {
                SeriesInstanceUID   = ivdc.Identity.SeriesInstanceUID,
                FrameOfReferenceUID = ivdc.FrameOfReferenceUID,
                SeriesLabel         = ivdc.Identity.Label,
            };

            return(isvm);
        }
Beispiel #4
0
        /// <summary>
        /// create for the series containing a single image
        /// </summary>
        /// <param name="idc">the data contract for the image</param>
        /// <returns>the new view model</returns>
        public static ImageSeriesViewModel Create(ImageDataContract idc)
        {
            var isvm = new ImageSeriesViewModel()
            {
                SeriesInstanceUID   = idc.SeriesInstanceUID,
                FrameOfReferenceUID = idc.FrameOfReferenceUID,
                SeriesLabel         = idc.Label,
            };

            return(isvm);
        }
Beispiel #5
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();
        }
Beispiel #6
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();
        }
Beispiel #7
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();
            }
        }