/// <summary>
    /// Set the Tags as Text of the last label created.
    /// </summary>
    public void FinaliseLabel(AnalysisRootObject analysisObject)
    {
        if (analysisObject.predictions != null)
        {
            // Sort the predictions to locate the highest one
            List <Prediction> sortedPredictions = new List <Prediction>();
            sortedPredictions = analysisObject.predictions.OrderByDescending(p => p.probability).ToList();
            foreach (Prediction prediction in sortedPredictions)
            {
                if (prediction.probability < probabilityThreshold)
                {
                    Debug.Log("Already at the threshold. Stopping");
                    break;
                }

                if (prediction.tagName != suitcaseLabel)
                {
                    Debug.Log("Skipping non-suitcase: " + prediction.tagName);
                    break;
                }
                GameObject label = CreateLabel();

                /// <summary>
                /// Reference to the last Label positioned
                /// </summary>
                Transform labelObj = Instantiate(label.transform, cursor.transform.position, transform.rotation);

                /// <summary>
                /// Reference to the last Label positioned
                /// </summary>
                TextMesh labelObjText = labelObj.GetComponent <TextMesh>();

                // Initialize new label
                PlaceAnalysisLabel(label, labelObj, labelObjText);

                quadRenderer = quad.GetComponent <Renderer>() as Renderer;
                Bounds quadBounds = quadRenderer.bounds;

                // Position the label as close as possible to the Bounding Box of the prediction
                // At this point it will not consider depth
                labelObj.transform.parent = quad.transform;
                MyRectangle positionRect = CalculateBoundingBoxPosition(quadBounds, prediction.boundingBox);
                labelObj.transform.localPosition = positionRect.GetCenter();

                // Cast a ray from the user's head to the currently placed label, it should hit the object detected by the Service.
                // At that point it will reposition the label where the ray HL sensor collides with the object,
                // (using the HL spatial tracking)
                Debug.Log("Repositioning Label");
                Vector3    headPosition = Camera.main.transform.position;
                RaycastHit objHitInfo;
                Vector3    objDirection     = labelObj.position;
                string     dimensionsString = "";
                if (Physics.Raycast(headPosition, objDirection, out objHitInfo, 30.0f, SpatialMapping.PhysicsRaycastMask))
                {
                    float widthInMeters  = 0;
                    float heightInMeters = 0;
                    labelObj.position = objHitInfo.point;
                    widthInMeters     = Vector3.Distance(new Vector3(positionRect.topLeft.x, positionRect.topLeft.y, objHitInfo.distance), new Vector3(positionRect.bottomRight.x, positionRect.topLeft.y, objHitInfo.distance));
                    heightInMeters    = Vector3.Distance(new Vector3(positionRect.topLeft.x, positionRect.topLeft.y, objHitInfo.distance), new Vector3(positionRect.topLeft.x, positionRect.bottomRight.y, objHitInfo.distance));
                    dimensionsString  = " - " + widthInMeters + "x" + heightInMeters;
                    // Draw rectangle around
                    DrawRect(positionRect, objHitInfo.distance);
                }

                // Set the tag text
                labelObjText.text = prediction.tagName + " (" + (prediction.probability * 100) + "%)" + dimensionsString;
            }
        }
        // Reset the color of the cursor
        cursor.GetComponent <Renderer>().material.color = Color.green;

        // Stop the analysis process
        ImageCapture.Instance.ResetImageCapture();
    }