Example #1
0
    // Called from buttons from input selection canvas
    public void ChangeInputImg()
    {
        var go = EventSystem.current.currentSelectedGameObject;

        // Detect which image was selected and save ID in selectedInput
        switch (go.name)
        {
        case "Input_Image_0":
            selectedInput = 0;
            break;

        case "Input_Image_1":
            selectedInput = 1;
            break;

        case "Input_Image_2":
            selectedInput = 2;
            break;

        case "Input_Image_3":
            selectedInput = 3;
            break;

        case "Input_Image_4":
            selectedInput = 4;
            break;

        case "Input_Image_5":
            selectedInput = 5;
            break;
        }

        Debug.Log("New input img: " + selectedInput);

        // Change input images in scene to new input image
        if (spriteLoader.GetInputImages().Length > selectedInput)
        {
            for (int i = 0; i < inputImages.Length; i++)
            {
                inputImages[i].sprite = spriteLoader.GetInputImages()[selectedInput];
            }
        }

        // change fms according to input selection if conv, pool or fc layer is open
        switch (selectedLayer.GetLayerType())
        {
        case "input":
        case "output":
            break;

        case "conv":
            UpdateFms("conv", "in");
            UpdateFms("conv", "out");
            break;

        case "pool":
            UpdateFms("pool", "in");
            UpdateFms("pool", "out");
            break;

        case "fc":
            UpdateFms("fc", "in");
            break;

        default:
            Debug.Log("CanvasController - Update(): Unknown layerType");
            break;
        }

        // Hide detail canvas for input fms
        //canvasFmDetails.gameObject.SetActive(false);
        canvasFmDetailsLeft.gameObject.SetActive(false);

        // update fm image for canvasFMDetails if the canvas is active
        if (canvasFmDetails.gameObject.activeSelf)
        {
            ShowLinkedFM(m_FMID);
        }

        // Change colorbar maximum values for feautre map detail canvas left and right according to input
        canvasFmDetailsLeft.transform.Find("Colorbar_Image/Max_Text").GetComponent <Text>().text = colorbarMaxValues[selectedInput].ToString(CultureInfo.InvariantCulture);
        canvasFmDetails.transform.Find("Colorbar_Image/Max_Text").GetComponent <Text>().text     = colorbarMaxValues[selectedInput].ToString(CultureInfo.InvariantCulture);

        // Show Filter Panel
        filterPanel.gameObject.SetActive(true);

        // Hide input selection canvas
        // Add animation?
        canvasInputSelect.gameObject.SetActive(false);
    }