Exemplo n.º 1
0
		private static void VolumeShelf_Closed(object sender, ClosedEventArgs e)
		{
			// note that the component is thrown away when the shelf is closed by the user
			_volumeShelf.Closed -= VolumeShelf_Closed;
			_volumeShelf = null;
			_volumeComponent = null;
		}
Exemplo n.º 2
0
            private void Complete()
            {
                if (IsAsynchronous)
                {
                    ItemsToExport.ForEach(delegate(IClipboardItem item) { item.Unlock(); });
                }

                _progressComponentShelf = null;

                //notify the owner that we're done.
                _exportComponent.OnMultipleImageExportComplete(_error);
                _error = null;

                _taskContext = null;
            }
Exemplo n.º 3
0
        public void OpenAnalysisTool()
        {
            if (_shelf != null)
            {
                _shelf.Activate();
            }
            else
            {
                StreamingAnalysisComponent component = new StreamingAnalysisComponent(base.Context);
                _shelf = ApplicationComponent.LaunchAsShelf(base.Context.DesktopWindow, component,
                                                            "Streaming Analysis", ShelfDisplayHint.DockFloat | ShelfDisplayHint.ShowNearMouse);

                _shelf.Closed += delegate { _shelf = null; };
            }
        }
Exemplo n.º 4
0
        private static void OnClipboardShelfClosed(object sender, ClosedEventArgs e)
        {
            IShelf clipboardShelf = (IShelf)sender;

            clipboardShelf.Closed -= OnClipboardShelfClosed;

            foreach (KeyValuePair <IDesktopWindow, IShelf> pair in ClipboardShelves)
            {
                if (pair.Value == clipboardShelf)
                {
                    ClipboardShelves.Remove(pair.Key);
                    break;
                }
            }
        }
        public void Apply()
        {
            if (_shelf != null)
            {
                _shelf.Activate();
                return;
            }

            PerformanceAnalysisComponent component = new PerformanceAnalysisComponent();

            _shelf = ApplicationComponent.LaunchAsShelf(this.Context.DesktopWindow, component, "Performance Analysis",
                                                        ShelfDisplayHint.DockFloat);

            _shelf.Closing += delegate { _shelf = null; };
        }
Exemplo n.º 6
0
        private static void OnShelfClosed(object sender, ClosedEventArgs e)
        {
            // We need to cache the owner DesktopWindow (_desktopWindow) because this tool is an
            // ImageViewer tool, disposed when the viewer component is disposed.  Shelves, however,
            // exist at the DesktopWindow level and there can only be one of each type of shelf
            // open at the same time per DesktopWindow (otherwise things look funny).  Because of
            // this, we need to allow this event handling method to be called after this tool has
            // already been disposed (e.g. viewer workspace closed), which is why we store the
            // _desktopWindow variable.

            IShelf shelf = (IShelf)sender;

            shelf.Closed -= OnShelfClosed;
            Shelves.Remove(shelf.DesktopWindow);
        }
		public void OpenAnalysisTool()
		{
			if (_shelf != null)
			{
				_shelf.Activate();
			}
			else
			{
				StreamingAnalysisComponent component = new StreamingAnalysisComponent(base.Context);
				_shelf = ApplicationComponent.LaunchAsShelf(base.Context.DesktopWindow, component, 
					"Streaming Analysis", ShelfDisplayHint.DockFloat | ShelfDisplayHint.ShowNearMouse);

				_shelf.Closed += delegate { _shelf = null; };
			}
		}
Exemplo n.º 8
0
 public void Show()
 {
     if (_shelves.ContainsKey(base.Context.DesktopWindow))
     {
         _shelves[base.Context.DesktopWindow].Activate();
     }
     else
     {
         this._window = base.Context.DesktopWindow;
         //IClientSetting clientSetting = new ClientSettingExtensionPoint().CreateExtension() as IClientSetting;
         PrintToolComponent component = new PrintToolComponent(this._window);
         IShelf             shelf     = ApplicationComponent.LaunchAsShelf(this._window, component, SR.Name, SR.Title, ShelfDisplayHint.DockAutoHide | ShelfDisplayHint.DockLeft);
         _shelves[this._window]         = shelf;
         _shelves[this._window].Closed += new EventHandler <ClosedEventArgs>(this.OnShelfClosed);
     }
 }
Exemplo n.º 9
0
		public void Show()
		{
			if (_volumeComponent == null)
			{
				// create and initialize the layout component
				_volumeComponent = new VolumeComponent(this.Context.DesktopWindow);

				// launch the layout component in a shelf
				_volumeShelf = ApplicationComponent.LaunchAsShelf(
					this.Context.DesktopWindow,
					_volumeComponent,
					SR.TitleVolumeController,
					ShelfDisplayHint.DockLeft);

				_volumeShelf.Closed += VolumeShelf_Closed;
			}
		}
Exemplo n.º 10
0
        public void Show()
        {
            if (_volumeComponent == null)
            {
                // create and initialize the layout component
                _volumeComponent = new VolumeComponent(this.Context.DesktopWindow);

                // launch the layout component in a shelf
                _volumeShelf = ApplicationComponent.LaunchAsShelf(
                    this.Context.DesktopWindow,
                    _volumeComponent,
                    SR.TitleVolumeController,
                    ShelfDisplayHint.DockLeft);

                _volumeShelf.Closed += VolumeShelf_Closed;
            }
        }
Exemplo n.º 11
0
        // Note: you may change the name of the 'Apply' method as desired, but be sure to change the
        // corresponding parameter in the MenuAction and ButtonAction attributes

        /// <summary>
        /// Called by the framework when the user clicks the "apply" menu item or toolbar button.
        /// </summary>
        public void Apply()
        {
            _component = new DicomEditorComponent();

            // Loop through all selected studies
            foreach (StudyItem selectedstudy in this.Context.SelectedStudies)
            {
                string studyUID     = selectedstudy.StudyInstanceUid;
                int    numberOfSops = LocalStudyLoader.Start(new StudyLoaderArgs(studyUID, null));

                // Loop through all images in study
                for (int i = 0; i < numberOfSops; ++i)
                {
                    Sop imageSop = LocalStudyLoader.LoadNextSop();
                    ILocalSopDataSource localsource = (ILocalSopDataSource)imageSop.DataSource;
                    // Load images into dicom editor
                    _component.Load(localsource.SourceMessage);
                    // Keep track of file paths for later re-importation
                    _filePaths.Add(localsource.Filename);
                }
                // This code deletes the study from the database, so that when it is re-imported the changed fields
                // will appear
                using (IDataStoreStudyRemover studyRemover = DataAccessLayer.GetIDataStoreStudyRemover())
                {
                    studyRemover.RemoveStudy(selectedstudy.StudyInstanceUid);
                }
            }
            // Launch Dicom Editor Shelf
            if (_shelf != null)
            {
                _shelf.Activate();
            }
            else
            {
                _shelf = ApplicationComponent.LaunchAsShelf(
                    this.Context.DesktopWindow,
                    _component,
                    "Dicom Editor",
                    "Dicom Editor",
                    ShelfDisplayHint.DockRight | ShelfDisplayHint.DockAutoHide);
                _shelf.Closed += OnShelfClosed;
            }

            _component.UpdateComponent();
        }
Exemplo n.º 12
0
        /// <summary>
        /// Shows the ROI Histogram component in a shelf.  Only one ROI Histogram component will ever be shown
		/// at a time, so if there is already an ROI Histogram component showing, this method does nothing
        /// </summary>
        public void Show()
		{
            // check if a layout component is already displayed
			if (_roiAnalysisComponent == null)
            {
                // create and initialize the layout component
				_roiAnalysisComponent = new RoiAnalysisComponentContainer(this.Context);
				
                // launch the layout component in a shelf
				_roiAnalysisShelf = ApplicationComponent.LaunchAsShelf(
                    this.Context.DesktopWindow,
					_roiAnalysisComponent,
                    SR.Title,
                    ShelfDisplayHint.DockLeft);

				_roiAnalysisShelf.Closed += RoiAnalysisShelf_Closed;
            }
        }
Exemplo n.º 13
0
        private static void OnWorkspaceActivated(object sender, ItemEventArgs <Workspace> e)
        {
            IShelf shelf = GetClipboardShelf(e.Item.DesktopWindow);

            if (shelf == null)
            {
                return;
            }

            KeyImageClipboardComponent clipboardComponent = shelf.Component as KeyImageClipboardComponent;

            if (clipboardComponent == null)
            {
                return;
            }

            clipboardComponent.KeyImageInformation = GetKeyImageInformation(e.Item) ?? new KeyImageInformation();
        }
Exemplo n.º 14
0
        /// <summary>
        /// Shows the ROI Histogram component in a shelf.  Only one ROI Histogram component will ever be shown
        /// at a time, so if there is already an ROI Histogram component showing, this method does nothing
        /// </summary>
        public void Show()
        {
            // check if a layout component is already displayed
            if (_roiAnalysisComponent == null)
            {
                // create and initialize the layout component
                _roiAnalysisComponent = new RoiAnalysisComponentContainer(this.Context);

                // launch the layout component in a shelf
                _roiAnalysisShelf = ApplicationComponent.LaunchAsShelf(
                    this.Context.DesktopWindow,
                    _roiAnalysisComponent,
                    SR.Title,
                    ShelfDisplayHint.DockLeft);

                _roiAnalysisShelf.Closed += RoiAnalysisShelf_Closed;
            }
        }
Exemplo n.º 15
0
        public void Show()
        {
            if (_shelf == null)
            {
                ClipboardComponent clipboardComponent = new ClipboardComponent();

                _shelf = ApplicationComponent.LaunchAsShelf(
                    this.Context.DesktopWindow,
                    clipboardComponent,
                    SR.TitleClipboard,
                    "Clipboard",
                    ShelfDisplayHint.DockLeft | ShelfDisplayHint.DockAutoHide);

                _shelf.Closed += OnShelfClosed;
            }
            else
            {
                _shelf.Show();
            }
        }
Exemplo n.º 16
0
        public void Show()
        {
            if (_shelf == null)
            {
                ClipboardComponent clipboardComponent = new ClipboardComponent(Clipboard.ClipboardSiteToolbar, Clipboard.ClipboardSiteMenu, Clipboard.Default, false);

                _shelf = ApplicationComponent.LaunchAsShelf(
                    this.Context.DesktopWindow,
                    clipboardComponent,
                    SR.TitleClipboard,
                    "¼ôÇаå",
                    ShelfDisplayHint.DockLeft | ShelfDisplayHint.DockAutoHide);

                _shelf.Closed += OnShelfClosed;
            }
            else
            {
                _shelf.Show();
            }
        }
	public static void Main()
	{
		Shelf myShelf = new Shelf(42, "Dull boring grey");
		
		myShelf.Color = "Red";
		
		
		IShelf myIShelf = myShelf;
		//myIShelf.Color = "Red"; - 'IShelf' does not contain a definition for 'Color'
		
		myShelf.Items.Add( new Book("Title 1", "Such a great book" ) );
		
		//Eos pass
		
		var book = myShelf.Items.SingleOrDefault( i => i.Name == "Title 1" );
		if( book != null ) {
			book.Thought = "I used to think it was such a great book. It's just OK";
			//book.BookSpecificProperty = "X"; - 'IShelfItem' does not contain a definition for 'BookSpecificProperty'
		}
	}
Exemplo n.º 18
0
        public void Show()
        {
            if (_shelf != null)
            {
                _shelf.Activate();
            }
            else
            {
                ExtensionBrowserComponent browser = new ExtensionBrowserComponent();

                _shelf = ApplicationComponent.LaunchAsShelf(
                    this.Context.DesktopWindow,
                    browser,
                    SR.TitleExtensionBrowser,
                    "Extension Browser",
                    ShelfDisplayHint.DockLeft | ShelfDisplayHint.DockAutoHide);

                _shelf.Closed += OnShelfClosed;
            }
        }
        public void CopySubset()
        {
            try
            {
                CopySubsetToClipboardComponent component;

                if (_copySubsetShelf != null)
                {
                    component = (CopySubsetToClipboardComponent)_copySubsetShelf.Component;
                    if (component.DesktopWindow != this.Context.DesktopWindow)
                    {
                        component.Close();
                    }
                    else
                    {
                        _copySubsetShelf.Activate();
                        return;
                    }
                }

                IDesktopWindow desktopWindow = this.Context.DesktopWindow;

                component = new CopySubsetToClipboardComponent(desktopWindow);

                _copySubsetShelf = ApplicationComponent.LaunchAsShelf(
                    desktopWindow,
                    component,
                    SR.TitleCopySubsetToClipboard,
                    ShelfDisplayHint.ShowNearMouse);

                _copySubsetShelf.Closed += delegate { _copySubsetShelf = null; };
            }
            catch (Exception e)
            {
                ExceptionHandler.Report(e, SR.MessageClipboardCopyFailed, Context.DesktopWindow);
            }
        }
Exemplo n.º 20
0
        public void Show()
        {
            // check if a layout component is already displayed
            if (_shelves.ContainsKey(this.Context.DesktopWindow))
            {
                _shelves[this.Context.DesktopWindow].Activate();
            }
            else
            {
                _desktopWindow = this.Context.DesktopWindow;

                AimAnnotationComponent aimComponent = new AimAnnotationComponent(this.Context.DesktopWindow);

                IShelf shelf = ApplicationComponent.LaunchAsShelf(
                    _desktopWindow,
                    aimComponent,
                    SR.TitleAIMCreater,
                    "AIM Annotation",
                    ShelfDisplayHint.DockRight | ShelfDisplayHint.DockAutoHide);

                shelf.Closed            += OnShelfClosed;
                _shelves[_desktopWindow] = shelf;
            }
        }
Exemplo n.º 21
0
 private void Shelf_Closed(object sender, ClosedEventArgs e)
 {
     //_shelf.Closed -= Shelf_Closed;
     _shelf = null;
 }
Exemplo n.º 22
0
 private void AddProduct(IShelf shelf, Product product)
 {
     shelf.AddProduct(product);
 }
Exemplo n.º 23
0
        /// <summary>
        /// Called by the framework when the user clicks the "apply" menu item or toolbar button.
        /// </summary>
        public void SeriesQuery()
        {

            string callingAE = ServerTree.GetClientAETitle();
            List<SeriesItem> SeriesList = new List<SeriesItem>();

            #region remote datastore
            // If remote data store, need to query server for series level information
            if (!this.Context.SelectedServerGroup.IsLocalDatastore)
            {
                // Loop through all selected servers
                foreach (Server node in this.Context.SelectedServerGroup.Servers)
                {
                    DicomAttributeCollection dicomAttributeCollection = new DicomAttributeCollection();
                    // Query on "Series" Level
                    dicomAttributeCollection[DicomTags.QueryRetrieveLevel].SetStringValue("SERIES");

                    string studyUID = this.Context.SelectedStudies[0].StudyInstanceUid;
                    dicomAttributeCollection[DicomTags.StudyInstanceUid].SetStringValue(studyUID);
                    dicomAttributeCollection[DicomTags.SeriesDescription].SetNullValue();
                    dicomAttributeCollection[DicomTags.SeriesInstanceUid].SetNullValue();
                    dicomAttributeCollection[DicomTags.SeriesNumber].SetNullValue();
                    dicomAttributeCollection[DicomTags.Modality].SetNullValue();
                    dicomAttributeCollection[DicomTags.Date].SetNullValue();
                    dicomAttributeCollection[DicomTags.Time].SetNullValue();
                    dicomAttributeCollection[DicomTags.RepetitionTime].SetNullValue();

                    IList<DicomAttributeCollection> resultsList;
                    StudyRootFindScu findScu = new StudyRootFindScu();
                    List<string> seriesUIDs = new List<string>();

                    resultsList = findScu.Find(
                                    callingAE,
                                    node.AETitle,
                                    node.Host,
                                    node.Port,
                                    dicomAttributeCollection);

                    findScu.CloseAssociation();
                    findScu.Dispose();

                    foreach (DicomAttributeCollection msg in resultsList)
                    {
                        string text = msg[DicomTags.SeriesInstanceUid];
                        Platform.Log(LogLevel.Info, text);

                        SeriesItem series = new SeriesItem();

                        series.SeriesNumber = msg[DicomTags.SeriesNumber];
                        series.SeriesDescription = msg[DicomTags.SeriesDescription];
                        series.StudyInstanceUID = msg[DicomTags.StudyInstanceUid];
                        series.SeriesInstanceUID = msg[DicomTags.SeriesInstanceUid];
                        series.Modality = msg[DicomTags.Modality];
                        series.Date = msg[DicomTags.Date];
                        series.Time = msg[DicomTags.Time];
                        //series.NumberOfSeriesRelatedInstances = int.Parse(msg[DicomTags.NumberOfSeriesRelatedInstances].ToString());
                        SeriesList.Add(series);

                    }
                    _component = new SeriesBrowserComponent(SeriesList, node);
                    _shelf = ApplicationComponent.LaunchAsShelf(this.Context.DesktopWindow, _component, "Series Browser", ShelfDisplayHint.DockBottom | ShelfDisplayHint.DockAutoHide);
                    _shelf.Closed += Shelf_Closed;
                }              
            }
            #endregion
           
            #region Local Datastore
            // If local datastore, can obtain series information by building study tree
            else
            {
                IImageViewer viewer = new ImageViewerComponent();
                StudyTree studyTree = viewer.StudyTree;

                // Add selected objects studies to study tree
                foreach (StudyItem selectedstudy in this.Context.SelectedStudies)
                {
                    string studyUID = selectedstudy.StudyInstanceUid;
                    int numberOfSops = LocalStudyLoader.Start(new StudyLoaderArgs(studyUID, null));
                    for (int i = 0; i < numberOfSops; ++i)
                    {
                        Sop imageSop = LocalStudyLoader.LoadNextSop();
                        studyTree.AddSop(imageSop);
                    }
                }

                foreach (Patient patient in studyTree.Patients)
                {
                    foreach (Study study in patient.Studies)
                    {
                        foreach (Series series in study.Series)
                        {
                            SeriesItem seriesitem = new SeriesItem();

                            seriesitem.SeriesNumber = series.SeriesNumber.ToString();
                            seriesitem.SeriesDescription = series.SeriesDescription;
                            seriesitem.StudyInstanceUID = study.StudyInstanceUid;
                            seriesitem.SeriesInstanceUID = series.SeriesInstanceUid;
                            seriesitem.Modality = series.Modality;
                            seriesitem.Date = series.SeriesDate;
                            seriesitem.Time = series.SeriesTime;
                            //series.NumberOfSeriesRelatedInstances = int.Parse(msg[DicomTags.NumberOfSeriesRelatedInstances].ToString());
                            seriesitem.NumberOfSeriesRelatedInstances = series.Sops.Count.ToString();

                            SeriesList.Add(seriesitem);
                        }
                    _component = new SeriesBrowserComponent(SeriesList, null);
                    _shelf = ApplicationComponent.LaunchAsShelf(this.Context.DesktopWindow, _component, DicomDataFormatHelper.PersonNameFormatter(patient.PatientsName), ShelfDisplayHint.DockBottom | ShelfDisplayHint.DockAutoHide);
                    _shelf.Closed += Shelf_Closed;
                    }
                }
            }
            #endregion

        }
Exemplo n.º 24
0
		private static void RoiAnalysisShelf_Closed(object sender, ClosedEventArgs e) {
			// note that the component is thrown away when the shelf is closed by the user
			_roiAnalysisShelf.Closed -= RoiAnalysisShelf_Closed;
			_roiAnalysisShelf = null;
			_roiAnalysisComponent = null;
		}
Exemplo n.º 25
0
 private bool ShelfHasPlace(IShelf shelf)
 {
     return(shelf.HasFreeSlot());
 }
Exemplo n.º 26
0
 public bool Equals(IShelf <string> x, IShelf <string> y)
 {
     return(x.Identifier == y.Identifier);
 }
Exemplo n.º 27
0
        /// <summary>
        /// Called by the framework when the user clicks the "apply" menu item or toolbar button.
        /// </summary>
        public void SeriesQuery()
        {
            string            callingAE  = ServerTree.GetClientAETitle();
            List <SeriesItem> SeriesList = new List <SeriesItem>();

            #region remote datastore
            // If remote data store, need to query server for series level information
            if (!this.Context.SelectedServerGroup.IsLocalDatastore)
            {
                // Loop through all selected servers
                foreach (Server node in this.Context.SelectedServerGroup.Servers)
                {
                    DicomAttributeCollection dicomAttributeCollection = new DicomAttributeCollection();
                    // Query on "Series" Level
                    dicomAttributeCollection[DicomTags.QueryRetrieveLevel].SetStringValue("SERIES");

                    string studyUID = this.Context.SelectedStudies[0].StudyInstanceUid;
                    dicomAttributeCollection[DicomTags.StudyInstanceUid].SetStringValue(studyUID);
                    dicomAttributeCollection[DicomTags.SeriesDescription].SetNullValue();
                    dicomAttributeCollection[DicomTags.SeriesInstanceUid].SetNullValue();
                    dicomAttributeCollection[DicomTags.SeriesNumber].SetNullValue();
                    dicomAttributeCollection[DicomTags.Modality].SetNullValue();
                    dicomAttributeCollection[DicomTags.Date].SetNullValue();
                    dicomAttributeCollection[DicomTags.Time].SetNullValue();
                    dicomAttributeCollection[DicomTags.RepetitionTime].SetNullValue();

                    IList <DicomAttributeCollection> resultsList;
                    StudyRootFindScu findScu    = new StudyRootFindScu();
                    List <string>    seriesUIDs = new List <string>();

                    resultsList = findScu.Find(
                        callingAE,
                        node.AETitle,
                        node.Host,
                        node.Port,
                        dicomAttributeCollection);

                    findScu.CloseAssociation();
                    findScu.Dispose();

                    foreach (DicomAttributeCollection msg in resultsList)
                    {
                        string text = msg[DicomTags.SeriesInstanceUid];
                        Platform.Log(LogLevel.Info, text);

                        SeriesItem series = new SeriesItem();

                        series.SeriesNumber      = msg[DicomTags.SeriesNumber];
                        series.SeriesDescription = msg[DicomTags.SeriesDescription];
                        series.StudyInstanceUID  = msg[DicomTags.StudyInstanceUid];
                        series.SeriesInstanceUID = msg[DicomTags.SeriesInstanceUid];
                        series.Modality          = msg[DicomTags.Modality];
                        series.Date = msg[DicomTags.Date];
                        series.Time = msg[DicomTags.Time];
                        //series.NumberOfSeriesRelatedInstances = int.Parse(msg[DicomTags.NumberOfSeriesRelatedInstances].ToString());
                        SeriesList.Add(series);
                    }
                    _component     = new SeriesBrowserComponent(SeriesList, node);
                    _shelf         = ApplicationComponent.LaunchAsShelf(this.Context.DesktopWindow, _component, "Series Browser", ShelfDisplayHint.DockBottom | ShelfDisplayHint.DockAutoHide);
                    _shelf.Closed += Shelf_Closed;
                }
            }
            #endregion

            #region Local Datastore
            // If local datastore, can obtain series information by building study tree
            else
            {
                IImageViewer viewer    = new ImageViewerComponent();
                StudyTree    studyTree = viewer.StudyTree;

                // Add selected objects studies to study tree
                foreach (StudyItem selectedstudy in this.Context.SelectedStudies)
                {
                    string studyUID     = selectedstudy.StudyInstanceUid;
                    int    numberOfSops = LocalStudyLoader.Start(new StudyLoaderArgs(studyUID, null));
                    for (int i = 0; i < numberOfSops; ++i)
                    {
                        Sop imageSop = LocalStudyLoader.LoadNextSop();
                        studyTree.AddSop(imageSop);
                    }
                }

                foreach (Patient patient in studyTree.Patients)
                {
                    foreach (Study study in patient.Studies)
                    {
                        foreach (Series series in study.Series)
                        {
                            SeriesItem seriesitem = new SeriesItem();

                            seriesitem.SeriesNumber      = series.SeriesNumber.ToString();
                            seriesitem.SeriesDescription = series.SeriesDescription;
                            seriesitem.StudyInstanceUID  = study.StudyInstanceUid;
                            seriesitem.SeriesInstanceUID = series.SeriesInstanceUid;
                            seriesitem.Modality          = series.Modality;
                            seriesitem.Date = series.SeriesDate;
                            seriesitem.Time = series.SeriesTime;
                            //series.NumberOfSeriesRelatedInstances = int.Parse(msg[DicomTags.NumberOfSeriesRelatedInstances].ToString());
                            seriesitem.NumberOfSeriesRelatedInstances = series.Sops.Count.ToString();

                            SeriesList.Add(seriesitem);
                        }
                        _component     = new SeriesBrowserComponent(SeriesList, null);
                        _shelf         = ApplicationComponent.LaunchAsShelf(this.Context.DesktopWindow, _component, DicomDataFormatHelper.PersonNameFormatter(patient.PatientsName), ShelfDisplayHint.DockBottom | ShelfDisplayHint.DockAutoHide);
                        _shelf.Closed += Shelf_Closed;
                    }
                }
            }
            #endregion
        }
Exemplo n.º 28
0
 public int GetHashCode(IShelf <string> obj)
 {
     // TODO: this is TERRIBLE, because it means that another shelf with the same ID, could be confused for this one
     return(obj.Identifier.GetHashCode());
 }
Exemplo n.º 29
0
 private void ShelfClose(object sender, EventArgs e)
 {
     this.mediaIShelf.Closed -= this.ShelfClose;
     this.mediaIShelf         = null;
 }
Exemplo n.º 30
0
			public void Run()
			{
				if (NumberOfImagesToExport <= 5)
				{
					BlockingOperation.Run(delegate { Export(null); });
					Complete();
				}
				else
				{
					ItemsToExport.ForEach(delegate(IClipboardItem item) { item.Lock(); });

					BackgroundTask task = new BackgroundTask(Export, true) {ThreadUICulture = Application.CurrentUICulture};

					ProgressDialogComponent progressComponent = new ProgressDialogComponent(task, true, ProgressBarStyle.Blocks);

					_progressComponentShelf = LaunchAsShelf(DesktopWindow, progressComponent,
																SR.TitleExportingImages, "ExportingImages",
																ShelfDisplayHint.DockFloat);

					_progressComponentShelf.Closed += delegate
														{
															Complete();
															task.Dispose();
														};
				}
			}
Exemplo n.º 31
0
 private void OnShelfClosed(object sender, ClosedEventArgs e)
 {
     _shelf = null;
 }
Exemplo n.º 32
0
			private void Complete()
			{
				if (IsAsynchronous)
					ItemsToExport.ForEach(delegate(IClipboardItem item) { item.Unlock(); });

				_progressComponentShelf = null;

				//notify the owner that we're done.
				_exportComponent.OnMultipleImageExportComplete(_error);
				_error = null;

				_taskContext = null;
			}
Exemplo n.º 33
0
 private static void OnShelfClosed(object sender, ClosedEventArgs e)
 {
     _shelf.Closed -= OnShelfClosed;
     _shelf         = null;
 }
Exemplo n.º 34
0
 private void Image_Shelf_Closed(object sender, ClosedEventArgs e)
 {
     //_image_shelf.Closed -= Image_Shelf_Closed;
     _image_shelf = null;
 }
        private void Dump()
        {
            if (this.ContextBase is IImageViewerToolContext)
            {
                IImageViewerToolContext context = this.ContextBase as IImageViewerToolContext;
                _desktopWindow = context.DesktopWindow;
                IImageSopProvider image = context.Viewer.SelectedPresentationImage as IImageSopProvider;
                if (image == null)
                {
                    _desktopWindow.ShowMessageBox(SR.MessagePleaseSelectAnImage, MessageBoxActions.Ok);
                    return;
                }

                IDicomMessageSopDataSource dataSource = image.ImageSop.DataSource as IDicomMessageSopDataSource;
                if (dataSource == null || dataSource.SourceMessage == null)
                {
                    _desktopWindow.ShowMessageBox(SR.MessageUnknownDataSource, MessageBoxActions.Ok);
                    return;
                }

                //Fix for Ticket #623 - HH - It turns out that for memory usage optimization the pixel data tag is stripped from the in memory dataset.
                //So while there are probably many better ways to address the missing pixel data tag a small hack was introduced because this entire utility will
                //be completely refactored in the very near future to make use of the methods the pacs uses to parse the tags.
                //Addendum to Comment above - HH 07/27/07 - Turns out that our implementation continues to remove the pixel data for optimization at this time so
                //the workaround is still needed.
                //Addendum to Comment above - JY 09/16/08 - Somewhere along the line, things were changed that made this line redundant - the only reference to
                //it after this point is at +11 lines or so, and all it does is get file.Filename. Therefore, I am commenting this line out.
                //file = new DicomFile(file.Filename);

                if (_component == null)
                {
                    _component = new DicomEditorComponent();
                }
                else
                {
                    _component.Clear();
                }

                _component.Load(dataSource.SourceMessage);
            }
            else if (this.ContextBase is ILocalImageExplorerToolContext)
            {
                ILocalImageExplorerToolContext context = this.ContextBase as ILocalImageExplorerToolContext;
                _desktopWindow = context.DesktopWindow;
                List <string> files = new List <string>();

                if (context.SelectedPaths.Count == 0)
                {
                    return;
                }

                foreach (string rawPath in context.SelectedPaths)
                {
                    if (string.IsNullOrEmpty(rawPath))
                    {
                        continue;
                    }

                    FileProcessor.Process(rawPath, "*.*", files.Add, true);
                }

                if (files.Count == 0)
                {
                    context.DesktopWindow.ShowMessageBox(SR.MessageNoFilesSelected, MessageBoxActions.Ok);
                    return;
                }

                if (_component == null)
                {
                    _component = new DicomEditorComponent();
                }
                else
                {
                    _component.Clear();
                }

                bool userCancelled = false;

                BackgroundTask task = new BackgroundTask(delegate(IBackgroundTaskContext backgroundcontext)
                {
                    int i = 0;

                    foreach (string file in files)
                    {
                        if (backgroundcontext.CancelRequested)
                        {
                            backgroundcontext.Cancel();
                            userCancelled = true;
                            return;
                        }
                        try
                        {
                            _component.Load(file);
                        }
                        catch (DicomException e)
                        {
                            backgroundcontext.Error(e);
                            return;
                        }
                        backgroundcontext.ReportProgress(new BackgroundTaskProgress((int)(((double)(i + 1) / (double)files.Count) * 100.0), SR.MessageDumpProgressBar));
                        i++;
                    }

                    backgroundcontext.Complete(null);
                }, true);

                try
                {
                    ProgressDialog.Show(task, _desktopWindow, true);
                }
                catch (Exception e)
                {
                    ExceptionHandler.Report(e, SR.MessageFailedDump, _desktopWindow);
                    return;
                }

                if (userCancelled == true)
                {
                    return;
                }
            }

            //common to both contexts
            if (_shelf != null)
            {
                _shelf.Activate();
            }
            else
            {
                _shelf = ApplicationComponent.LaunchAsShelf(
                    _desktopWindow,
                    _component,
                    SR.TitleDicomEditor,
                    "Dicom Editor",
                    ShelfDisplayHint.DockRight | ShelfDisplayHint.DockAutoHide);
                _shelf.Closed += OnShelfClosed;
            }

            _component.UpdateComponent();
        }
Exemplo n.º 36
0
        public void Open()
        {
            try
            {
                if (!Enabled)
                {
                    return;
                }

                int numberOfSelectedStudies = Context.SelectedStudies.Count;
                if (Context.SelectedStudies.Count == 0)
                {
                    return;
                }

                int numberOfLoadableStudies = GetNumberOfLoadableStudies();
                if (numberOfLoadableStudies != numberOfSelectedStudies)
                {
                    int    numberOfNonLoadableStudies = numberOfSelectedStudies - numberOfLoadableStudies;
                    string message;
                    if (numberOfSelectedStudies == 1)
                    {
                        message = SR.MessageCannotOpenNonStreamingStudy;
                    }
                    else
                    {
                        if (numberOfNonLoadableStudies == 1)
                        {
                            message = SR.MessageOneNonStreamingStudyCannotBeOpened;
                        }
                        else
                        {
                            message = String.Format(SR.MessageFormatXNonStreamingStudiesCannotBeOpened, numberOfNonLoadableStudies);
                        }
                    }

                    Context.DesktopWindow.ShowMessageBox(message, MessageBoxActions.Ok);
                    return;
                }

                UIStudyTree tree = new UIStudyTree();

                foreach (var item in Context.SelectedStudies)
                {
                    if (item.Server.IsLocal)
                    {
                        using (var context = new DataAccessContext())
                        {
                            IStudy study = context.GetStudyBroker().GetStudy(item.StudyInstanceUid);
                            if (study != null)
                            {
                                tree.AddStudy(study);
                            }
                        }
                    }
                }

                if (this.mediaIShelf != null)
                {
                    this.mediaIShelf.Activate();
                    component.Tree = tree.Tree;
                }
                else
                {
                    if (base.Context.DesktopWindow == null)
                    {
                        return;
                    }

                    component                = new MediaWriterComponent();
                    this.mediaIShelf         = ApplicationComponent.LaunchAsShelf(base.Context.DesktopWindow, component, "Media Writer", ShelfDisplayHint.DockAutoHide | ShelfDisplayHint.DockLeft);
                    this.mediaIShelf.Closed += new EventHandler <ClosedEventArgs>(this.ShelfClose);
                    this.mediaIShelf.Activate();
                    component.Tree = tree.Tree;
                }
            }
            catch (Exception exception)
            {
                ExceptionHandler.Report(exception, base.Context.DesktopWindow);
            }
        }
Exemplo n.º 37
0
        private void Shelf_Closed(object sender, ClosedEventArgs e)
        {
            //_shelf.Closed -= Shelf_Closed;
            _shelf = null;

        }
Exemplo n.º 38
0
        private void OnShelfClosed(object sender, ClosedEventArgs e)
        {
            // We need to cache the owner DesktopWindow (_desktopWindow) because this tool is an 
            // ImageViewer tool, disposed when the viewer component is disposed.  Shelves, however,
            // exist at the DesktopWindow level and there can only be one of each type of shelf
            // open at the same time per DesktopWindow (otherwise things look funny).  Because of 
            // this, we need to allow this event handling method to be called after this tool has
            // already been disposed (e.g. viewer workspace closed), which is why we store the 
            // _desktopWindow variable.

            //trigger an import of the Renamed files.
            LocalDataStoreServiceClient client = new LocalDataStoreServiceClient();
            client.Open();
            try
            {
                FileImportRequest request = new FileImportRequest();
                request.BadFileBehaviour = BadFileBehaviour.Move;
                request.FileImportBehaviour = FileImportBehaviour.Move;
                request.FilePaths = _filePaths;
                request.Recursive = false;
                client.Import(request);
                client.Close();
            }
            catch
            {
                client.Abort();
                throw;
            }

            _shelf.Closed -= OnShelfClosed;
            _shelf = null;
        }
        /// <summary>
        /// Called by the framework when the user clicks the "apply" menu item or toolbar button.
        /// </summary>
        public void Edit()
        {
            _component = new DicomEditorComponent();
            List<string> filePaths = new List<string>();
       
            // Loop through all items in clipboard (code from CC forum)
            foreach (IClipboardItem item in this.Context.SelectedClipboardItems)
            {
                List<IPresentationImage> queue = new List<IPresentationImage>();
                if (item.Item is IPresentationImage)
                    Enqueue(queue, (IPresentationImage)item.Item);
                else if (item.Item is IDisplaySet)
                    Enqueue(queue, (IDisplaySet)item.Item);
                else if (item.Item is IImageSet)
                    Enqueue(queue, (IImageSet)item.Item);

                foreach (IPresentationImage image in queue)
                {
                    if (image is IImageSopProvider)
                    {
                        ImageSop imageSop = ((IImageSopProvider)image).ImageSop;

                        ILocalSopDataSource localsource = (ILocalSopDataSource)imageSop.DataSource;
                        // Load each image path into dicom editor, and record path in array for later, re-import
                        _component.Load(localsource.SourceMessage);
                        filePaths.Add(localsource.Filename);
                    }
                }
            }
            //common to both contexts
            if (_shelf != null)
            {
                _shelf.Activate();
            }
            else
            {
                _shelf = ApplicationComponent.LaunchAsShelf(
                    this.Context.DesktopWindow,
                    _component,
                    "Dicom Editor",
                    "Dicom Editor",
                    ShelfDisplayHint.DockRight | ShelfDisplayHint.DockAutoHide);
                _shelf.Closed += OnShelfClosed;
            }

            _component.UpdateComponent();

            //trigger an import of the Renamed files.
            LocalDataStoreServiceClient client = new LocalDataStoreServiceClient();
            client.Open();
            try
            {
                FileImportRequest request = new FileImportRequest();
                request.BadFileBehaviour = BadFileBehaviour.Move;
                request.FileImportBehaviour = FileImportBehaviour.Move;
                request.FilePaths = filePaths;
                request.Recursive = false;
                client.Import(request);
                client.Close();
            }
            catch
            {
                client.Abort();
                throw;
            }
        }
Exemplo n.º 40
0
        private void OnShelfClosed(object sender, ClosedEventArgs e)
        {
            // We need to cache the owner DesktopWindow (_desktopWindow) because this tool is an 
            // ImageViewer tool, disposed when the viewer component is disposed.  Shelves, however,
            // exist at the DesktopWindow level and there can only be one of each type of shelf
            // open at the same time per DesktopWindow (otherwise things look funny).  Because of 
            // this, we need to allow this event handling method to be called after this tool has
            // already been disposed (e.g. viewer workspace closed), which is why we store the 
            // _desktopWindow variable.

            _shelf.Closed -= OnShelfClosed;
            _shelf = null;
        }
        /// <summary>
        /// Called by the framework when the user clicks the "apply" menu item or toolbar button.
        /// </summary>
        public void Edit()
        {
            _component = new DicomEditorComponent();
            List <string> filePaths = new List <string>();

            // Loop through all items in clipboard (code from CC forum)
            foreach (IClipboardItem item in this.Context.SelectedClipboardItems)
            {
                List <IPresentationImage> queue = new List <IPresentationImage>();
                if (item.Item is IPresentationImage)
                {
                    Enqueue(queue, (IPresentationImage)item.Item);
                }
                else if (item.Item is IDisplaySet)
                {
                    Enqueue(queue, (IDisplaySet)item.Item);
                }
                else if (item.Item is IImageSet)
                {
                    Enqueue(queue, (IImageSet)item.Item);
                }

                foreach (IPresentationImage image in queue)
                {
                    if (image is IImageSopProvider)
                    {
                        ImageSop imageSop = ((IImageSopProvider)image).ImageSop;

                        ILocalSopDataSource localsource = (ILocalSopDataSource)imageSop.DataSource;
                        // Load each image path into dicom editor, and record path in array for later, re-import
                        _component.Load(localsource.SourceMessage);
                        filePaths.Add(localsource.Filename);
                    }
                }
            }
            //common to both contexts
            if (_shelf != null)
            {
                _shelf.Activate();
            }
            else
            {
                _shelf = ApplicationComponent.LaunchAsShelf(
                    this.Context.DesktopWindow,
                    _component,
                    "Dicom Editor",
                    "Dicom Editor",
                    ShelfDisplayHint.DockRight | ShelfDisplayHint.DockAutoHide);
                _shelf.Closed += OnShelfClosed;
            }

            _component.UpdateComponent();

            //trigger an import of the Renamed files.
            LocalDataStoreServiceClient client = new LocalDataStoreServiceClient();

            client.Open();
            try
            {
                FileImportRequest request = new FileImportRequest();
                request.BadFileBehaviour    = BadFileBehaviour.Move;
                request.FileImportBehaviour = FileImportBehaviour.Move;
                request.FilePaths           = filePaths;
                request.Recursive           = false;
                client.Import(request);
                client.Close();
            }
            catch
            {
                client.Abort();
                throw;
            }
        }
Exemplo n.º 42
0
        private void Dump()
        {
            if (this.ContextBase is IImageViewerToolContext)
            {
                IImageViewerToolContext context = this.ContextBase as IImageViewerToolContext;
                _desktopWindow = context.DesktopWindow;
                IImageSopProvider image = context.Viewer.SelectedPresentationImage as IImageSopProvider;
                if (image == null)
                {                    
                    _desktopWindow.ShowMessageBox(SR.MessagePleaseSelectAnImage, MessageBoxActions.Ok);
                    return;
                }

            	IDicomMessageSopDataSource dataSource = image.ImageSop.DataSource as IDicomMessageSopDataSource;
				if (dataSource == null || dataSource.SourceMessage ==  null)
				{
					 _desktopWindow.ShowMessageBox(SR.MessageUnknownDataSource, MessageBoxActions.Ok);
					return;
				}

                //Fix for Ticket #623 - HH - It turns out that for memory usage optimization the pixel data tag is stripped from the in memory dataset.  
                //So while there are probably many better ways to address the missing pixel data tag a small hack was introduced because this entire utility will 
                //be completely refactored in the very near future to make use of the methods the pacs uses to parse the tags.
                //Addendum to Comment above - HH 07/27/07 - Turns out that our implementation continues to remove the pixel data for optimization at this time so 
                //the workaround is still needed.
				//Addendum to Comment above - JY 09/16/08 - Somewhere along the line, things were changed that made this line redundant - the only reference to
				//it after this point is at +11 lines or so, and all it does is get file.Filename. Therefore, I am commenting this line out.
                //file = new DicomFile(file.Filename);

                if (_component == null)
                {
                    _component = new DicomEditorComponent();
                }
                else
                {
                    _component.Clear();
                }

                _component.Load(dataSource.SourceMessage);
            }
            else if (this.ContextBase is ILocalImageExplorerToolContext)
            {
                ILocalImageExplorerToolContext context = this.ContextBase as ILocalImageExplorerToolContext;
                _desktopWindow = context.DesktopWindow;
                List<string> files = new List<string>();

                if (context.SelectedPaths.Count == 0)
                    return;

                foreach (string rawPath in context.SelectedPaths)
                {
                	if (string.IsNullOrEmpty(rawPath))
                		continue;

                    FileProcessor.Process(rawPath, "*.*", files.Add, true);
                }

                if (files.Count == 0)
                {
                    context.DesktopWindow.ShowMessageBox(SR.MessageNoFilesSelected, MessageBoxActions.Ok);
                    return;
                }

                if (_component == null)
                {
                    _component = new DicomEditorComponent();
                }
                else
                {
                    _component.Clear();
                }

                bool userCancelled = false;

                BackgroundTask task = new BackgroundTask(delegate(IBackgroundTaskContext backgroundcontext)
                {
                    int i = 0;

                    foreach (string file in files)
                    {
                        if (backgroundcontext.CancelRequested)
                        {
                            backgroundcontext.Cancel();
                            userCancelled = true;
                            return;
                        }
                        try
                        {
                            _component.Load(file);
                        }
                        catch (DicomException e)
                        {
                            backgroundcontext.Error(e);
                            return;
                        }
                        backgroundcontext.ReportProgress(new BackgroundTaskProgress((int)(((double)(i + 1) / (double)files.Count) * 100.0), SR.MessageDumpProgressBar));
                        i++;
                    }

                    backgroundcontext.Complete(null);
                }, true);

                try
                {
                    ProgressDialog.Show(task, _desktopWindow, true);
                }
                catch (Exception e)
                {
                    ExceptionHandler.Report(e, SR.MessageFailedDump, _desktopWindow);
                    return;
                }

                if (userCancelled == true)
                    return;
            }

            //common to both contexts
            if (_shelf != null)
            {
                _shelf.Activate();
            }
            else
            {
                _shelf = ApplicationComponent.LaunchAsShelf(
                    _desktopWindow,
                    _component,
                    SR.TitleDicomEditor,
                    "Dicom Editor",
                    ShelfDisplayHint.DockRight | ShelfDisplayHint.DockAutoHide);
                _shelf.Closed += OnShelfClosed;
            }
  
            _component.UpdateComponent();

        }
Exemplo n.º 43
0
 public int GetHashCode(IShelf <string> obj)
 {
     return(obj?.Identifier.GetHashCode() ?? -1);
 }
Exemplo n.º 44
0
        // Note: you may change the name of the 'Apply' method as desired, but be sure to change the
        // corresponding parameter in the MenuAction and ButtonAction attributes

        /// <summary>
        /// Called by the framework when the user clicks the "apply" menu item or toolbar button.
        /// </summary>
        public void Apply()
        {
            _component = new DicomEditorComponent();
            
            // Loop through all selected studies
            foreach (StudyItem selectedstudy in this.Context.SelectedStudies)
            {
                string studyUID = selectedstudy.StudyInstanceUid;
                int numberOfSops = LocalStudyLoader.Start(new StudyLoaderArgs(studyUID, null));
                
                // Loop through all images in study
                for (int i = 0; i < numberOfSops; ++i)
                {
                    Sop imageSop = LocalStudyLoader.LoadNextSop();
                    ILocalSopDataSource localsource = (ILocalSopDataSource)imageSop.DataSource;
                    // Load images into dicom editor
                    _component.Load(localsource.SourceMessage);
                    // Keep track of file paths for later re-importation
                    _filePaths.Add(localsource.Filename);
                }
                // This code deletes the study from the database, so that when it is re-imported the changed fields 
                // will appear
                using (IDataStoreStudyRemover studyRemover = DataAccessLayer.GetIDataStoreStudyRemover())
                {
                    studyRemover.RemoveStudy(selectedstudy.StudyInstanceUid);
                }
            }
            // Launch Dicom Editor Shelf
            if (_shelf != null)
            {
                _shelf.Activate();
            }
            else
            {
                _shelf = ApplicationComponent.LaunchAsShelf(
                    this.Context.DesktopWindow,
                    _component,
                    "Dicom Editor",
                    "Dicom Editor",
                    ShelfDisplayHint.DockRight | ShelfDisplayHint.DockAutoHide);
                _shelf.Closed += OnShelfClosed;
            }

            _component.UpdateComponent();
        }