|Deletions are marked like this.||Additions are marked like this.|
|Line 21:||Line 21:|
|Throughout this course you will be using the unix terminal to interact with FreeSurfer and FreeView. Writing programs that operate through the terminal lets the programmer focus entirely on making powerful and functional software without spending work hours designing a clickable interface. But stay tuned - more graphical interaction is coming for FreeSurfer in the future!||Throughout this course you will be using the unix terminal to interact with FreeSurfer and FreeView. Writing programs that operate through the terminal lets the programmer focus entirely on making powerful and functional software without spending work hours designing and debugging a clickable interface. But stay tuned - more graphical interaction is coming for FreeSurfer in the future! But many users find the terminal to be the fastest way to operate a computer once they get the hang of it.|
Who this tutorial is for:
People with little to no Unix experience, or with some experience but looking for a Unix basics refresher.
What are the goals of this tutorial:
To let the student practice the unix skills and concepts needed to enjoy this course. The skills include:
- Understanding the unix file system
- Understanding how to navigate the unix file system with cd and ls
- Understanding that some information can be accessed anywhere via PATH
- Understanding how to reorient yourself when lost
What is a Unix terminal?
The terminal is a way for you to interact with your computer - just like you interact with your phone through the touch screen or your laptop through the track pad. The terminal lets you interact with your computer through typed in commands.
Why learn Unix?
Throughout this course you will be using the unix terminal to interact with FreeSurfer and FreeView. Writing programs that operate through the terminal lets the programmer focus entirely on making powerful and functional software without spending work hours designing and debugging a clickable interface. But stay tuned - more graphical interaction is coming for FreeSurfer in the future! But many users find the terminal to be the fastest way to operate a computer once they get the hang of it.
How do I use the terminal?
Let's get this tutorial started.
Click the terminal icon on the left side of your screen to launch the terminal.
Whenever you launch the terminal, you can imagine it as if you are getting in your car. You car has a location, and you drive your car around to move it from location to location to get around the world. The terminal has a location, and “drive” it by typing in commands.
There are different ways to mark the location of objects in the world. Lattitude, Longitude, addresses, landmarks, etc. Locations in the terminal are marked through directories.
It will help if you right click the top of the window then choose always on top.
When you open a terminal it usually takes you to your home directory. Type this into the terminal then press enter
The terminal now lists everything in your home directory. You will see a bunch of folders with different names like “Photos” “Documents”. One of them is “freesurfer” Lets navigate into that folder. Type
And press enter.
Then type ls in again and look at what you see. These are some of the files and folders that make up Freesurfer. There is a lot more to FreeSurfer than just this, inside of those folders ar emore files and folders, and so on and so on. Lets examine the data in one of these files. If you look through the files listed in ls there is one called README, you can peek inside by typing
Press q to leave
Less is a tool in unix that lets you quickly take a peek at files.
Not lets leave the freesurfer directory, you can exit a directory by typing cd.. Do that now
Now lets navigate to the data you will using thorughout the week, type in
Cd lets you change directories, and $TUTORIAL_DATA is a variable we set up earlier which is the directory of all the data you will use in the tutorial. You can take a peek inside what $TUTORIAL_DATA is representing by typing
You will see the address of the tutorial data. Echo doesn’t actually make any changes or move where you are - echo just prints out whatever comes after it.
Lets look at some data, type in cd practice_with_data
Type cd dicoms
This is is a list of discoms taken from an mri scan - you will learn more about this data in a future tutorial.
Navigate out of that directory, with cd ..
Then cd into Subj001
Type ls, the list of directories you see is a typical set of directories created by freesurfer after it runs a set of data through its pipeline.
We are not going to take a look at some of this data with FreeView!
Freeview -v orig.mgz
This is an example of an argument. The creators of FreeView haad to decide a way to let the user choose what kind of file they want to open, and which of that file to open. -v means you want to open a volume, and the name of te volume is orig.mgz
Now there are some tricky things here. For example you types in freeview… but there was no Freeview in that directory! So where did it come from? Before you came to class we set up something called a Path, which is a list of directories Unix will search in whenever you launch a command. So, Freeview is in the path, so Freeview was found even though it wasnt in your current directory. NOTE: Allow user to experiment with this. Orig.mgz was in that directory, so it was found. Close Freeview with the x in the upper right hand corner. Now try something.
Navigate up one directory by typiong in cd..
Type ls to see what is in there
Now type Freeview -v orig.mgz just lke before
You will get an error that the file was not found! That is because orig.mgz was not in the directory you are in. Here is what would have worked, feel free to try.
Freeview -v mri/orig.mgz
A volume is one type of data you use in freesurfer, a surface is anohter. Lets open a surface.
Enter the tutorial_data folder again, either by doing the cd.. Comand a couple of types or typing in cd $TUTORIAL_DATA
You also could have accessed that by typiong cd $TUTORIAL_DATA/buckner_data/tutorial_subjs/good_output/surf but I prefer to go dir by dir.
Type ls and look at allk that data!
Lets open one
Freeview -f lh.pial rh.pial -viewport 3d
-f lets us open surfaces, and -viewport lets us choose what kind of view we want to take. You will get more familiar with these commands as the course goes on.