Beispiel #1
0
        /// <summary>
        /// Initializes the 2D view with the given ImageStack
        /// </summary>
        public void Initialize(ImageStack imageStack)
        {
            foreach (var type in Enum.GetValues(typeof(SliceType)).Cast <SliceType>())
            {
                _selection[type] = 0;
            }

            if (_pixelClickHandler == null)
            {
                _pixelClickHandler = gameObject.GetComponentInChildren <PixelClickHandler>();
            }

            _imageStack = imageStack;

            SliceSlider.MaximumValue = _imageStack.GetMaxValue(CurrentSliceType);
            SliceSlider.CurrentInt   = _selection.GetValue(CurrentSliceType, 0);

            _pixelClickHandler.OnPixelClick.AddListener(OnPixelClicked);

            try
            {
                // key might not be present in dictionary
                Display.texture = _imageStack.GetTexture2D(CurrentSliceType, _selection.GetValue(CurrentSliceType));
            }
            finally
            {
                ResetClickDisplay(_imageStack.Width, _imageStack.Height);
                ClickDisplay.color = new Color32(255, 255, 255, 255);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Swaps the displayed SliceType for the given SliceType
        /// </summary>
        /// <param name="type">SliceType to display.</param>
        public void Show(SliceType type)
        {
            CurrentSliceType         = type;
            _ignoreSliderChanges     = true;
            SliceSlider.MaximumValue = _imageStack.GetMaxValue(CurrentSliceType);
            _ignoreSliderChanges     = false;
            SliceSlider.CurrentInt   = _selection[CurrentSliceType];

            Display.texture = _imageStack.GetTexture2D(CurrentSliceType, _selection[CurrentSliceType]);

            if (ClickDisplay.texture.width != Display.texture.width ||
                ClickDisplay.texture.height != Display.texture.height)
            {
                ResetClickDisplay(Display.texture.width, Display.texture.height);
            }
            else
            {
                ResetClick();
            }
        }
Beispiel #3
0
 public void Initialize(ImageStack stack)
 {
     _imageStack          = stack;
     _transStep           = 1f / (stack.GetMaxValue(SliceType.Transversal));
     TransSlider.maxValue = stack.GetMaxValue(SliceType.Transversal);
 }