コード例 #1
0
        public override void Start(HumanSubject current_subject = null)
        {
            if (current_subject != null)
            {
                _current_subject = current_subject;

                if (current_subject.AllObjectImages.Count == 0 && current_subject.AllObjectImageLocations.Count == 0)
                {
                    var res_folder = HumanAcceleratedLearningConfiguration.GetInstance().ResourcesFolder;
                    var img_path   = HumanAcceleratedLearningConfiguration.GetInstance().ObjectLocationImagesPath;
                    var all_images = Directory.GetFiles(res_folder + img_path).ToList();

                    current_subject.AllObjectImages = all_images;
                    last_picture_display_time       = DateTime.MinValue;
                    current_image_index             = 0;

                    for (int i = 0; i < all_images.Count; i++)
                    {
                        var loc_x = MathHelperMethods.RandomNumbers.Next(1, Convert.ToInt32(grid_columns) - 1);
                        var loc_y = MathHelperMethods.RandomNumbers.Next(1, Convert.ToInt32(grid_rows) - 1);
                        current_subject.AllObjectImageLocations.Add(new Tuple <int, int>(loc_x, loc_y));
                    }

                    //Save all of the object locations to a file
                    ObjectLocation_FileHandler.WriteAllObjectLocationsToFile(current_subject);
                }

                //Create a shuffled list of image indices for this study session
                var all_indices = Enumerable.Range(0, current_subject.AllObjectImages.Count).ToList();
                shuffled_list_of_image_indices = MathHelperMethods.ShuffleList(all_indices);

                //Create a file for this study session
                fid = StudyBlock.CreateStudyBlockFile(current_subject.UserName);

                HasPhaseStarted = true;
                StartTime       = DateTime.Now;
            }
        }
コード例 #2
0
        public override void Start(HumanSubject current_subject = null)
        {
            if (current_subject != null)
            {
                _current_subject          = current_subject;
                last_picture_display_time = DateTime.MinValue;
                current_image_index       = 0;

                if (current_subject.AllObjectImages.Count == 0)
                {
                    ObjectLocation_FileHandler.ReadObjectLocationFile(current_subject);

                    /*var res_folder = HumanAcceleratedLearningConfiguration.GetInstance().ResourcesFolder;
                     * var img_path = HumanAcceleratedLearningConfiguration.GetInstance().ObjectLocationImagesPath;
                     * var all_images = Directory.GetFiles(res_folder + img_path).ToList();
                     *
                     * current_subject.AllObjectImages = all_images;*/
                }

                if (current_subject.AllObjectImages.Count > 0)
                {
                    //Remove images that have already been correctly answered
                    usable_images          = current_subject.AllObjectImages.Where((y, x) => !current_subject.CorrectlyAnsweredImageList.Contains(x)).ToList();
                    usable_image_positions = current_subject.AllObjectImageLocations.Where((y, x) => !current_subject.CorrectlyAnsweredImageList.Contains(x)).ToList();

                    //Create a shuffled list of image indices for this study session
                    var all_indices = Enumerable.Range(0, usable_images.Count).ToList();
                    shuffled_list_of_image_indices = MathHelperMethods.ShuffleList(all_indices);

                    //Create a file for this study session
                    fid = TestBlock.CreateTestBlockFile(current_subject.UserName);

                    HasPhaseStarted = true;
                    StartTime       = DateTime.Now;
                }
            }
        }