예제 #1
0
        public ActionResult SendFile(string base64String, string filename, string mime)
        {
            var imageSetCollection = new ImageSetCollection()
            {
                ImageSets = new List <ImageSet>()
                {
                    new ImageSet()
                    {
                        Name         = "test",
                        ImageSetType = ClaimImageSetTypes.BackSidePictures,
                        Images       = new List <Image>()
                        {
                            new Image()
                            {
                                FileName = filename,
                                MimeType = mime,
                                //ImageData = Convert.FromBase64String(base64),
                                Base64Image = base64String
                            }
                        }
                    }
                }
            };

            var service = new ApiServiceReference.MobileServiceClient("api");
            var result  = service.UploadImageSets(imageSetCollection);

            //var result = service.PostBase64(base64);

            return(View("Index"));
        }
예제 #2
0
        public static ImageSetEntity GetByUid(string imageSetUid)
        {
            ImageSetCollection imageSets = new ImageSetCollection();

            imageSets.GetMulti(new PredicateExpression(ImageSetFields.UniqueIdentifier == imageSetUid));
            return(imageSets.Count > 0 ? imageSets[0] : null);
        }
예제 #3
0
		public void Test()
		{
			IImageSet imageSet1 = CreateImageSet("Patient1", "Patient1");
			IImageSet imageSet2 = CreateImageSet("Patient1", "Patient1");
			ImageSetCollection collection = new ImageSetCollection();
			collection.Add(imageSet1);
			collection.Add(imageSet2);

			ImageSetGroups groups = new ImageSetGroups(collection);
			Assert.IsTrue(groups.Root.Items.Count == 0);
			Assert.IsTrue(groups.Root.ChildGroups.Count == 1);
			Assert.IsTrue(groups.Root.ChildGroups[0].Items.Count == 2);

			imageSet1.Dispose();
			imageSet2.Dispose();
		}
예제 #4
0
        public void Test()
        {
            IImageSet          imageSet1  = CreateImageSet("Patient1", "Patient1");
            IImageSet          imageSet2  = CreateImageSet("Patient1", "Patient1");
            ImageSetCollection collection = new ImageSetCollection();

            collection.Add(imageSet1);
            collection.Add(imageSet2);

            ImageSetGroups groups = new ImageSetGroups(collection);

            Assert.IsTrue(groups.Root.Items.Count == 0);
            Assert.IsTrue(groups.Root.ChildGroups.Count == 1);
            Assert.IsTrue(groups.Root.ChildGroups[0].Items.Count == 2);

            imageSet1.Dispose();
            imageSet2.Dispose();
        }
예제 #5
0
        private void TestSortingImageSetsByStudyDate(bool reverse, bool useSops, bool testLayoutManagerSort)
        {
            ImageSetCollection orderedCollection    = new ImageSetCollection();
            ImageSetCollection nonOrderedCollection = new ImageSetCollection();
            StudyTree          studyTree            = new StudyTree();

            for (int i = 0; i <= 20; ++i)
            {
                string   id       = i.ToString();
                ImageSet imageSet = new ImageSet();
                imageSet.Name = id;

                string studyDate;
                if (i == 0)
                {
                    studyDate = "";
                }
                else
                {
                    studyDate = String.Format("200801{0}", i.ToString("00"));
                }

                if (useSops)
                {
                    DisplaySet displaySet = new DisplaySet(id, id);
                    ImageSop   sop        = NewImageSop(id, id, i);
                    imageSet.Uid = sop.StudyInstanceUid;
                    studyTree.AddSop(sop);

                    IPresentationImage image       = new DicomGrayscalePresentationImage(sop.Frames[1]);
                    IImageSopProvider  sopProvider = (IImageSopProvider)image;

                    DicomMessageSopDataSource dataSource = ((DicomMessageSopDataSource)sopProvider.ImageSop.DataSource);
                    dataSource.SourceMessage.DataSet[DicomTags.StudyDate].SetString(0, studyDate);
                    imageSet.DisplaySets.Add(displaySet);
                    displaySet.PresentationImages.Add(image);
                }
                else
                {
                    StudyRootStudyIdentifier identifier = new StudyRootStudyIdentifier();
                    identifier.StudyDate        = studyDate;
                    identifier.StudyInstanceUid = id;
                    ImageSetDescriptor descriptor = new DicomImageSetDescriptor(identifier);
                    imageSet.Descriptor = descriptor;
                }

                orderedCollection.Add(imageSet);
            }

            if (reverse)
            {
                List <IImageSet> temp = new List <IImageSet>();
                temp.AddRange(orderedCollection);
                temp.Reverse();
                orderedCollection.Clear();
                foreach (IImageSet imageSet in temp)
                {
                    orderedCollection.Add(imageSet);
                }
            }

            Randomize(orderedCollection, nonOrderedCollection);

            Debug.WriteLine("Before Sort\n------------------------\n");
            CollectionUtils.ForEach(nonOrderedCollection,
                                    imageSet => Debug.WriteLine(String.Format("name: {0}, date: {1}", imageSet.Name,
                                                                              ((IImageSopProvider)(imageSet.DisplaySets[0].PresentationImages[0])).
                                                                              ImageSop.StudyDate)));

            if (testLayoutManagerSort)
            {
                LayoutManager.SortImageSets(nonOrderedCollection, GetStudies(orderedCollection, studyTree));
            }
            else
            {
                nonOrderedCollection.Sort(new StudyDateComparer(reverse));
            }

            Debug.WriteLine("\nAfter Sort\n------------------------\n");
            CollectionUtils.ForEach(nonOrderedCollection,
                                    imageSet => Debug.WriteLine(String.Format("name: {0}, date: {1}", imageSet.Name,
                                                                              ((IImageSopProvider)(imageSet.DisplaySets[0].PresentationImages[0])).
                                                                              ImageSop.StudyDate)));

            if (reverse)
            {
                nonOrderedCollection.RemoveAt(20);
            }
            else
            {
                nonOrderedCollection.RemoveAt(0);
            }

            int j = reverse ? 20 : 1;

            foreach (IImageSet set in nonOrderedCollection)
            {
                Assert.AreEqual(j.ToString(), set.Name);
                j += reverse ? -1 : 1;
            }

            foreach (IImageSet set in nonOrderedCollection)
            {
                set.Dispose();
            }
            foreach (IImageSet set in orderedCollection)
            {
                set.Dispose();
            }

            studyTree.Dispose();
        }
예제 #6
0
        public bool UploadImageSets(ImageSetCollection imageSetCollection)
        {
            var imgSets = imageSetCollection.ImageSets;

            return(true);
        }
예제 #7
0
		private void DisposeImageSets()
		{
			if (this.ImageSets == null)
				return;

			foreach (ImageSet imageSet in this.ImageSets)
				imageSet.Dispose();

			_imageSets.ItemAdded -= OnImageSetAdded;
			_imageSets = null;
		}