For Non-Coding Audience
Summary of csdGUI’s purpose and functionalities
The purpose of csdGUI is to provide an easy-to-use interface for both the non-coding and coding audience to conduct CSD (current source density) analysis on visual stimulation experiment data. The goal of the analysis is to identify the depth and thickness of layer 4 of the primary visual cortex (V1) along with the actual depths of each of the channels on the electrode. In doing so, an additional set of results will be present to supplement and confirm the accuracy of histology performed on the V1. Meanwhile, the actual depths of the various recorded cells can also be confirmed.
The CSD procurement/analysis involves  data acquisition,  data processing, and  CSD analysis.  Data acquisition falls outside the scope of the csdGUI since that involves visual stimulation experimentation on the ferret post-surgery and collection of the LFPs (local field potentials) picked up by all channels of the electrode. Following data acquisition, the csdGUI is responsible for data processing along with CSD analysis.  Data processing involves the GUI to processing the raw experimental data by snipping out LFP signals of relevant timeframes and aggregating this data into a cell data structure. Because of the sheer size of data that is being identified and collected, the processing step can take anywhere from one day to two weeks to complete. The parallel computing feature in MATLAB is a future solution to the extensive runtime of the data aggregation/processing. Upon completion of  data processing, the user will be able to proceed with  CSD Analysis.  CSD analysis involves plotting out the CSD data for every grid that flashes on the TV screen during the  data acquisition procedure. The user then selects the grid that shows proper CSD distribution and the csdGUI plots out the LFP and CSD information for every channel for that selected grid. Being able to see the information clearly for the selected grid, the user then clicks on middle, top, and bottom of the layer 4 sink, for which the proper depth values will be displayed. Following this, the user is able to proceed with the csd2correcteddepth_single or csd2correcteddepth_multiple to identify the actual depth values for all cells of interest.
Instructions for running the csdGUI (CSD Graphical User Interface)
1. Check that the “Parameter Entry” section is filled out correctly. As a reference, here is a brief explanation of what is appropriate for the entries:
Path: The path folder that contains the data folder
Tfile: The name of the data folder. The last component of the entry should be a “/”.
Tbefore: The number of seconds [s] the user wishes to acquire before the onset of each stimulus.
Tafter: The number of seconds [s] the user wishes to acquire data after the onset of each stimulus.
Num_Channels: (Will be filled out upon electrode selection) The number of channels that the electrode has, including the sync channel.
Channel_Order: (Will be filled out upon electrode selection) The order of the channels in an array data structure.
Channels: (Will be filled out upon electrode selection) The first data acquisition channel followed by a “:” and the last data acquisition channel.
csdGUI names the channels differently from the Van Hooser data acquisition format. Looking under data information in the figure below, the first line shows: ChannelString: Dev1/ai31, Dev1/ai0:30. The single channel, Dev1/ai31, which is also the sync channel (because it is individually named), refers to “channel 1” in csdGUI format. Following the sync channel, there is “Dev1/ai0:30,” which corresponds to the 31 data acquisition channels. The data acquisition channels can also be understood as Dev1/ai0 to and including Dev1/ai30. In csdGUI format, Dev1/ai0, the first data acquisition channel, is “channel 2” since it is the channel after the sync channel, which is “channel 1.” Likewise, Dev1/ai30, the last data acquisition channel, is “channel 32” since it is the 31 channels after “channel 1.” The interesting thing is that within the channel_order array, Dev1/ai0 is “channel 1” while Dev1/ai30 is “channel 31.” Likewise, Dev/ai31 is “channel 32.”
Delta: (Will be filled out upon electrode selection) This is the distance between the channels of the electrode in microns [um].
2. Press the "Display Information" button (see A above), which will tell csdGUI to display relevant information on the electrode (B), data acquisition method (B), and the transition of interest (C). Some of this information can be seen below.
3. Select the appropriate electrode from the “Electrode selection” popup menu (D). This will result in the configurations of that electrode to be taken into account by the code. Usually, the appropriate electrode can be identified by "NumChans" in the data information being displayed.
4. Check either “w2b” or “b2w” (E) based on the "transition of interest" (C) that is displayed upon completing step 2.
5. Click on the “Process Data” button (F).
6. Wait until the progress bar has reached completion. There are currently 3 progress bar cycles per transition type which means you will see 3 progress bars run to completion before the data for a transition type has finished processing. Another signal for completion is that the “w2b exists” or “b2w exists” light turns green.
1. Click the load button corresponding to the data you have processed (w2b or b2w). Once you have successfully loaded the data, either the "w2b loaded" or "b2w loaded" light should turn green. In the picture below, both w2b and b2w exist; however, b2w was chosen to be loaded and was loaded successfully.
2. Click on the “CSD Analysis” and wait for the CSD data for all grids to be plotted out. This step can take anywhere from 20 seconds to 2 minutes. Just like the "process data" procedure in the data processing section, a progress bar should pop up. There are 2 cycles to this progress bar which means that 2 progress bars should run to completion before the CSD data is ready for analysis.
3. Upon plotting out the CSD data for all grids, you will see the following image on the top left corner of the GUI. At this point you will want to click the grid that looks most identical to “real” CSD data. You should take note that “sinks” are red and “sources” are blue. In this case, we will go ahead and click on the grid at the 9th column and 5th row.
4. At this point the LFP and CSD data for the selected grid will be plotted and labeled figures 1-4 on the GUI. You can proceed with any of the three following selections:
(a) Click on another grid to select another grid
(b) Determine the CSD depth and actual channel depths.
(c) Plot out individual graphs of figures 1-4 so that they are in a more publishing-friendly format
5. Usually what happens next is that 4(a) is repeated until the correct grid is located. Then, you can proceed with 4(b). To proceed with 4(b), you will need to click on "Area B" in the labeled picture above. This will call on a MATLAB function called “ginput.” This function will prompt a target cursor to appear, which will allow you to make exactly 3 clicks, so be careful not to click the wrong spots! The first click will be in the middle of the sink that you think should correspond to layer 4 while the second and third clicks correspond to the top and bottom of the layer 4 sink respectively. Please see the picture below for reference.
If you make a mistake with "ginput," you can click on "Area B" again to prompt the "ginput" functionality and try again.
6. After clicking at the appropriate positions, the layer 4 data should be outputted on the GUI.
7. Now, you will want to plot out the data in a more publishing-friendly format. This can be done by clicking inside "Area B" in the figure shown below.
8. Make sure to click “Analysis Done” until the CSD analysis status shows “CSD Analysis is complete”; otherwise, the csdGUI will be buggy. Take note that you may need to click on "Analysis Done more than once for the "CSD Analysis is complete" display to show up.
For Coding Audience
The code used within csdGUI is the exact same as the functions used in the text-based interface. Please refer to the corresponding documentation for an in-depth explanation of the code. In any case, the code should be well-commented and therefore easy to understand.