Exemplo n.º 1
0
        public object[][] ExportData()
        {
            List <object[]> data = new List <object[]>();

            data.Add(Whiskers.Select(target => target.Whisker.WhiskerName).Cast <object>().ToArray());
            data.Add(Whiskers.Select(whisker => whisker.Frequency).Cast <object>().ToArray());

            return(data.ToArray());
        }
Exemplo n.º 2
0
        public object[][] ExportMeanData()
        {
            List <object[]> data = new List <object[]>();

            data.Add(new object[] { "Mean Offset" });
            data.Add(Whiskers.Select(target => target.Whisker.WhiskerName).Cast <object>().ToArray());
            data.Add(Whiskers.Select(whisker => whisker.MeanOffset).Cast <object>().ToArray());

            return(data.ToArray());
        }
        private void RemovePoint()
        {
            if (GenericPoints.Count == 0)
            {
                return;
            }

            Whiskers.RemoveAt(Whiskers.Count - 1);
            GenericPoints.RemoveAt(GenericPoints.Count - 1);

            OkCommand.RaiseCanExecuteChangedNotification();
            RemovePointCommand.RaiseCanExecuteChangedNotification();
        }
Exemplo n.º 4
0
        public override void LoadData()
        {
            Model.LoadData(Parent.Frames.Values.Select(x => x.Model).ToArray());

            CheckForErrors();

            CreateFrames();

            SelectedWhisker = Whiskers.First();

            Initialise();

            Loaded = true;
        }
        private void OkPressed()
        {
            string errors = "";

            if (!Validate(ref errors))
            {
                MessageBox.Show(errors, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            ExitResult = WindowExitResult.Ok;

            Model.Whiskers = Whiskers.ToArray();

            CloseWindow();
        }
Exemplo n.º 6
0
        private void CreateFrames()
        {
            ObservableCollection <SingleWhiskerFrequencyViewModel> whiskers = new ObservableCollection <SingleWhiskerFrequencyViewModel>();

            foreach (ISingleWhiskerFrequency frequency in Model.Whiskers)
            {
                SingleWhiskerFrequencyViewModel frequencyViewModel = new SingleWhiskerFrequencyViewModel(frequency);
                //frequencyViewModel.EnabledChanged += PropagateWhiskerEnabledNotification;
                whiskers.Add(frequencyViewModel);
            }

            Whiskers        = whiskers;
            SelectedWhisker = Whiskers.First();

            ObservableCollection <WhiskersEnabledViewModel> displayWhiskers = new ObservableCollection <WhiskersEnabledViewModel>();

            foreach (SingleWhiskerFrequencyViewModel whisker in Whiskers)
            {
                WhiskersEnabledViewModel displayWhisker = new WhiskersEnabledViewModel(this, whisker);
                displayWhiskers.Add(displayWhisker);
            }

            ObservableCollection <AngleTypeBase> angleOptions = new ObservableCollection <AngleTypeBase>();

            IWhisker nosePoint        = Parent.CurrentFrame.Whiskers.Select(x => x.Model).FirstOrDefault(x => x.WhiskerId == -1);
            IWhisker orientationPoint = Parent.CurrentFrame.Whiskers.Select(x => x.Model).FirstOrDefault(x => x.WhiskerId == 0);

            if (nosePoint != null && orientationPoint != null)
            {
                angleOptions.Add(new CenterLineViewModel());
            }

            angleOptions.Add(new VerticalViewModel());
            angleOptions.Add(new HorizontalViewModel());

            AngleOptions        = angleOptions;
            SelectedAngleOption = AngleOptions.First();

            DisplayWhiskers = displayWhiskers;

            CreateGraphData();
        }
Exemplo n.º 7
0
        private void IncreaseWhiskerCounter()
        {
            int pointsLength = WhiskerPoints.Count;

            if (CurrentPoint < pointsLength)
            {
                SelectedWhiskerPoint = WhiskerPoints[CurrentPoint];
                return;
            }

            int selectedWhiskerIndex = Whiskers.IndexOf(SelectedWhisker);

            if (selectedWhiskerIndex + 1 < Whiskers.Count)
            {
                SelectedWhisker = Whiskers[selectedWhiskerIndex + 1];
            }
            else if (AutoNextFrame)
            {
                GetNextFrame();
            }
        }
Exemplo n.º 8
0
        private void UndoLastAction()
        {
            if (m_UndoActions.Count == 0)
            {
                return;
            }

            WhiskerPointViewModel whiskerPoint = m_UndoActions.Last();

            if (whiskerPoint != null)
            {
                int whiskerId = whiskerPoint.Model.Parent.WhiskerId;
                int pointId   = whiskerPoint.Model.PointId;

                WhiskerViewModel whisker = Whiskers.Single(x => x.WhiskerId == whiskerId);

                if (whisker != null)
                {
                    WhiskerPointViewModel whiskerPointToReplace = whisker.WhiskerPoints.Single(x => x.PointId == pointId);

                    if (whiskerPointToReplace != null)
                    {
                        int index = whisker.WhiskerPoints.IndexOf(whiskerPointToReplace);

                        whisker.WhiskerPoints[index] = whiskerPoint;
                        RemoveUndoAction(whiskerPoint);

                        CreateWhiskerPointsList();
                        CreatePrevWhiskerPointsList();

                        //Need to re-select the Whisker and/or Whisker Point
                        SelectedWhisker      = whisker;
                        SelectedWhiskerPoint = whiskerPoint;
                    }
                }
            }
        }
 private void AddWhisker(IWhiskerClipSettings whisker)
 {
     Whiskers.Add(whisker);
     OkCommand.RaiseCanExecuteChangedNotification();
 }
Exemplo n.º 10
0
 public double[] GetWhiskerFrequencySignal(int whiskerId)
 {
     return(Whiskers.Single(x => x.WhiskerId == whiskerId).Signal);
 }
Exemplo n.º 11
0
        public ISingleFrameExtendedResults GetData()
        {
            ISingleFrameExtendedResults result = ModelResolver.Resolve <ISingleFrameExtendedResults>();

            if (HeadPoints != null)
            {
                result.HeadPoints = HeadPoints.Select(x => x.GetPoint()).ToArray();
            }
            else
            {
                result.HeadPoints = null;
            }

            if (BodyContour != null)
            {
                result.BodyContour = BodyContour.Select(x => x.GetPoint()).ToArray();
            }
            else
            {
                result.BodyContour = null;
            }

            if (HeadPoint != null)
            {
                result.HeadPoint = HeadPoint.GetPoint();
                result.MidPoint  = MidPoint.GetPoint();
            }

            if (SmoothedHeadPoint != null)
            {
                result.SmoothedHeadPoint = SmoothedHeadPoint.GetPoint();
            }

            if (Orientation != null)
            {
                result.Orientation = Orientation.GetVector();
            }

            result.CentroidSize    = CentroidSize;
            result.PelvicArea      = PelvicArea;
            result.Velocity        = Velocity;
            result.AngularVelocity = AngularVelocity;
            result.Distance        = Distance;
            result.PelvicArea2     = PelvicArea2;
            result.PelvicArea3     = PelvicArea3;
            result.PelvicArea4     = PelvicArea4;

            if (Centroid != null)
            {
                result.Centroid = Centroid.GetPoint();
            }

            if (Whiskers != null)
            {
                result.Whiskers = Whiskers.GetWhiskerCollection();
            }

            if (AllWhiskers != null)
            {
                result.AllWhiskers = AllWhiskers.GetWhiskerCollection();
            }

            if (BestTrackedWhisker != null)
            {
                result.BestTrackedWhisker = BestTrackedWhisker.GetWhiskerCollection();
            }

            result.DataLoadComplete();
            return(result);
        }