Exemplo n.º 1
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--content",
                        help="1: Point To Target" + " 2: Change Detection" +
                        " 3: Odd One Out" + " 4: Visual Search" +
                        " 5: Multiple Object Tracking" +
                        " 6: Random Dot Motion Descrimination",
                        type=int,
                        default=1)
    args = parser.parse_args()

    content_type = args.content

    if content_type == CONTENT_POINT_TO_TARGET:
        content = PointToTargetContent()
    elif content_type == CONTENT_CHANGE_DETECTION:
        content = ChangeDetectionContent()
    elif content_type == CONTENT_ODD_ONE_OUT:
        content = OddOneOutContent()
    elif content_type == CONTENT_VISUAL_SEARCH:
        content = VisualSearchContent()
    elif content_type == CONTENT_MULTIPLE_OBJECT_TRACKING:
        content = MultipleObjectTrackingContent()
    else:
        content = RandomDotMotionDiscriminationContent()

    FPS = 60
    display_size = (128 * 4 + 16, 500)
    inspector = Inspector(content, display_size)

    clock = pygame.time.Clock()
    running = True

    frame_count = 0

    if RECORDING:
        writer = MovieWriter("out.mov", inspector.display_size, FPS)

    while running:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False

        inspector.update()
        clock.tick(FPS)

        if RECORDING:
            d = inspector.get_frame()
            writer.add_frame(d)

            frame_count += 1

            if frame_count > 1000:
                running = False

    if RECORDING:
        writer.close()
Exemplo n.º 2
0
def get_content(content_type):
    if content_type == Contents.POINT_TO_TARGET:
        content = PointToTargetContent()
    elif content_type == Contents.CHANGE_DETECTION:
        content = ChangeDetectionContent()
    elif content_type == Contents.ODD_ONE_OUT:
        content = OddOneOutContent()
    elif content_type == Contents.VISUAL_SEARCH:
        content = VisualSearchContent()
    elif content_type == Contents.MULTIPLE_OBJECT_TRACKING:
        content = MultipleObjectTrackingContent()
    else:
        content = RandomDotMotionDiscriminationContent()
    return content
Exemplo n.º 3
0
import flask
from flask import Flask, make_response, send_from_directory
from jinja2 import FileSystemLoader
from werkzeug.local import Local, LocalManager

app = Flask(__name__, static_url_path='')
app.secret_key = 'oculomotor'
app.jinja_loader = FileSystemLoader(os.getcwd() + '/templates')

contents = [
    PointToTargetContent(),
    ChangeDetectionContent(),
    OddOneOutContent(),
    VisualSearchContent(),
    MultipleObjectTrackingContent(),
    RandomDotMotionDiscriminationContent(),
]

display_size = (128 * 4 + 16, 500)


class Runner(object):
    def __init__(self):
        self.content_id = 0
        self.inspector = Inspector(contents[self.content_id], display_size)
        self.lock = Lock()

    def step(self):
        with self.lock:
            self.inspector.update()
            image = self.inspector.get_frame()
Exemplo n.º 4
0
    id='MultipleObjectTrackingSkip-v0',
    entry_point='gym_oculoenv.oculo:GymOculoEnv',
    kwargs={'content': MultipleObjectTrackingContent(), 'skip_red_cursor': True}
)

register(
    id='MultipleObjectTrackingRetina-v0',
    entry_point='gym_oculoenv.oculo:GymOculoEnv',
    kwargs={'content': MultipleObjectTrackingContent(), 'retina': True}
)

# RandomDotMotionDiscrimination
register(
    id='RandomDotMotionDiscrimination-v0',
    entry_point='gym_oculoenv.oculo:GymOculoEnv',
    kwargs={'content': RandomDotMotionDiscriminationContent()}
)

register(
    id='RandomDotMotionDiscriminationSkip-v0',
    entry_point='gym_oculoenv.oculo:GymOculoEnv',
    kwargs={'content': RandomDotMotionDiscriminationContent(), 'skip_red_cursor': True}
)

register(
    id='RandomDotMotionDiscriminationRetina-v0',
    entry_point='gym_oculoenv.oculo:GymOculoEnv',
    kwargs={'content': RandomDotMotionDiscriminationContent(), 'retina': True}
)

register(
Exemplo n.º 5
0
def make_contents():
    return [PointToTargetContent(), ChangeDetectionContent(), OddOneOutContent(), VisualSearchContent(), MultipleObjectTrackingContent(), RandomDotMotionDiscriminationContent()]