Esempio n. 1
0
        /// <summary>
        /// Preprocessing of the DiFiles is completed.
        /// </summary>
        private void OnPreProcessDone()
        {
            WindowSettingsPanel.EnableButtons();

            MainMenu.EnableButtons();
            MainMenu.EnableDropDown();
            var preview = MainMenu.PreviewImage.texture as Texture2D;

            if (!preview || preview.width != _stack.Width || preview.height != _stack.Height)
            {
                // Could be avoided if single preloaded texture would be stored in imagestack to save memory
                preview = new Texture2D(_stack.Width, _stack.Height, TextureFormat.ARGB32, false);
                MainMenu.PreviewImage.texture = preview;
            }

            var pixels = preview.GetPixels32();

            ImageStack.FillPixelsTransversal(_stack.Slices / 2, _stack.GetData(), _stack.Width, _stack.Height, _stack.DicomFiles, pixels);

            preview.SetPixels32(pixels);
            preview.Apply();

            MainMenu.PreviewImage.texture = preview;

            _workIndicator.FinishedWork();
        }
Esempio n. 2
0
        /// <summary>
        /// Starts creating a Segmentation
        /// </summary>
        /// <typeparam name="TP">The type of the segmentation parameters</typeparam>
        /// <param name="index">Index of the segment to create, range ist limited from 0 to 2</param>
        /// <param name="segmentationStrategy">Strategy for creating a Segmentation</param>
        /// <param name="parameters">Parameters used by the segmentation strategy</param>
        /// <param name="clearSegment">controls whether the segment will be cleared before creating the segment, defaults to true</param>
        public void CreateSegment <TP>(uint index, SegmentationStrategy <TP> segmentationStrategy, TP parameters, bool clearSegment = true)
        {
            if (clearSegment)
            {
                _segments[GetIndex(index)].Clear();
            }

            _currentWorkloads.Add(new Tuple <ThreadGroupState, uint, Action <uint> >(
                                      segmentationStrategy.Fit(_segments[GetIndex(index)], _imageStack.GetData(), parameters), index, OnSegmentChange));
            _workIndicator.StartedWork();
        }