---
# System prepended metadata

title: '**Computer Technique in Pain Lab**'
tags: [pain]

---

---
tags: pain
---

<center>

# **Computer Technique in Pain Lab**

:::info
Location: Medical School of NTU
Time: you know how to find me.
:::

</center>

<div style="text-align: right">``xxx''<br>-- xxx</div>

## **Class Information**

### Instructor
- Name: 盧政良 (Zheng-Liang Lu, Arthur)
- Email: arthurzllu@gmail.com

### Objectives
- Write Presentation programs for clinic experiments of neuroscience
- Write MATLAB programs for data processing and analysis
- Manage computers

### Prerequisites
- Basic and common logic
- Mathematics of basic level

### Working Environment
- Presentation on Windows XP
- MATLAB 2015 on MacOS

## **Lectures**

### Presentation Programming
- Overview: Architecture
- Scenario Definition Language (SDL)
- Presentation Control Language (PCL)
- fMRI Mode Interfacing

```latex
\frame{Agenda}
    \item Overview: Architecture
    \item Scenario Definition Language (SDL)
    \item Presentation Control Language (PCL)
    \item fMRI Mode Interfacing
    
\frame{Overview: Architecture}
    \item SDL
    \item PCL
    \item Communication
    % Illustration: [SDL + PCL] <---> fMRI
    % Key points: SDL           -> raw material
    %             PCL           -> cooking
    %             Communication -> delivery?
    
\frame{SDL: Definitions}
    \item We define new components in SDL section.
    \item Experiment
        \item Session
            \item Task
                \item Trial
\frame{Trial}
    \item A trial contains information for the moment/period.
        \item picture
            \item text
            \item box
            \item bitmap
        \item stimulus event
            \item code
            
\frame{Text Object}
\frame{Example}
\frame{Bitmap Object}
\frame{Example 1}
\frame{Example 2}
\frame{Digression: Object}
    \item An object consists of its properties with methdos.
    \item For example, box.
    \item Check the documentation for details: ...
\frame{PCL: Flow Controls & Subroutines}
    \item In SDL section, we prepare the raw materials (components) for the experiments.
    \item We proceed to introduce the flow controls of PCL section:
        \item Conditional statements: if-elseif-else.
        \item Repetitions (loops): loop-until.
    \item In the end, we will know how to reuse your code snippets by wrapping in subroutines.
\frame{Conditional Statements}
\frame{Loops}
\frame{Digression: int i = 1}
    % Illustration: cup + label + ingredient
\frame{Example 1: Counting}
\frame{Exercise: Running Sum}
\frame{Example 2: Random Numbers}
\frame{Exercise: TBA}
\frame{Example 3: Double Loops}
\frame{Exercise: TBA}
\frame{Example 4: Infinite Loops}
\frame{Exercise: TBA}
    \item Write a program for SQUID GAME: 10個左右選項，猜錯就遊戲結束而且會被懲罰 (電刺激)。
\frame{Subroutines}
    \item Don't copy \& paste codes neither write the same codes.
    \item We wrap the code snippets in subroutines for future use.
\frame{Example 1}
\frame{Digression: array<int> &output[rows][cols]}
\frame{Example 2}
\frame{Example 3}
\frame{Control Management}
    \item Keyboard
    \item Mouse
    \item DAQ
\frame{Example: VAS}
\frame{Exercise}
\frame{fMRI Setting}
\frame{Coworking with LABView}
\frame{Case Study: A Complete Presentation Program}
\frame{Advanced Topics}
    \item Randomization in SDL section

```

### MATLAB Programming
- Variables, data types, and vectorization
- Data structures
- File I/O
- Flow controls
- Text processing
- 2D and 3D plots
- Functions

## **References**

### Presentation
- [Neuro-Behavioral Systems](http://www.neurobs.com/)

### MATLAB
- Zheng-Liang Lu, [Introduction to MATLAB Programming with Applications](https://www.csie.ntu.edu.tw/~d00922011/matlab.html), Department of Computer Science and Information Engineering, National Taiwan University

### Statistics
- Zheng-Liang Lu, [Introduction to Data Science](https://hackmd.io/@arthurzllu/ByC0nhVkr), Department of Computer Science and Information Engineering, National Taiwan University