function convertStringToArray(inputString) { // Split the string by the delimiter '/' const stringArray = inputString.split(","); // Convert each element to a number const numberArray = stringArray.map(Number); return numberArray; } function filterAndSortMeasurementsByIds(measurements, ids) { return measurements .filter((measurement) => ids.includes(measurement.id)) .sort((a, b) => new Date(a.timestamp) - new Date(b.timestamp)); } function checkVideoPath(videos, name) { let res = true; videos.forEach(video => { const videoName = video.name; if(videoName==name) res=false; }); return res; } function getMeasurementsIdsFromForm(choice, firstInput, lastInput) { if (choice === 'oneByOne') { const highlightedButtons = document.querySelectorAll('.number-button.highlight'); return Array.from(highlightedButtons).map(button => parseInt(button.textContent)); } else { const first = parseInt(firstInput.value); const last = parseInt(lastInput.value); const denominator = parseInt(document.getElementById('denominator').value); const measurementIds = new Set(); measurementIds.add(first); // Always include the first image // Iterate through the range, adding the step size for (let i = first + denominator; i <= last; i += denominator) { measurementIds.add(i); } measurementIds.add(last); // Always include the last image // Convert the Set back to an array and sort it return Array.from(measurementIds).sort((a, b) => a - b); } }