===========================================================================================
ToDo now:

fullfile
Warning: Inputs must be character arrays or cell arrays of strings.

upsampleFactor
  n = viewSize(view) ./ dataSize(view,scan);
  if n(1) ~= n(2)
      disp('Warning! upSampling is different in x and y');
  end
change calls in the following functions to use ./ instead of /
   getCurDataROI
   getTSeriesROI
   ip2volCorAnal
   ip2volParMap
   ip2volTSeries 
pad or remove rows/cols from inplanes during convert2to3

mrInitRet, verify25Session
separate function that "verifies" a mrLoadRet-25 session, checks the mrSESSION structure 
and the directory tree and prompts the user if fixes are needed. Then
convert2to3 could call this new function. That seems much cleaner (modular) to me than
incorporating the error handling into the convert code. The convert
code could get really ugly otherwise.

3D area of current ROI:
Warning: Subscript indices must be integer values.
> In Y:\mri\mrLoadRet-3.0\Analysis\Area\measureFlatROIArea.m at line 60
??? Index exceeds matrix dimensions.
Error in ==> Y:\mri\mrLoadRet-3.0\Analysis\Area\measureFlatROIArea.m
On line 60  ==> [flatCoords,ROIIndices,flatIndices] = 
intersectCols(ROIcoords,round(flatView.coords{h}));

MakeDir: 
Replace mkdir calls everywhere to use MakeDir that checks if dir exists before calling mkdir.
Should also call mkdirWinSafe (or extract the relevant code from that function)
to allow mkdir when in a UNC path. 

use timestamp from gray and flat files (see Wade's email message)

select window:
Trap mouse clicks on window titlebars as well as clicks on the window contents.

mrGray interface

flipTSeries & shiftTSeries
should save add'l info in the tSeries directory, annotation for changes to the tSeries
motion comp code could do the same thing in addition to or instead of making copies.

===========================================================================================
Analysis:

design.mat
conditionNames: cell array of strings
  names of each condition/trial type
events: 3xN array
  1st row start times (in seconds)
  2nd row duration (sec)
  3rd row condition/trial type
  
Maybe save analysisParams with result instead of in dataTYPES
Each parameter map would be a structure:
co.map
co.analysisParams
analysisParams is set up such that each param is a substructure
  co.analysisParams.detrend.validOptions
  co.analysisParams.detrend.values
where values is either a vector or a cell array

Otherwise, simplify the analysisParams structure in dataTYPES
dataTYPES blockedAnalysisParams -> analysisParams
  detrend
  inhomoCorrect
  nCycles
  nullCondition
  startTimeOffset (sec)
  durationIncrement (sec)

Simple event-analysis, average trials for each trial type
  generate simulated data set
  produces new "scans" in Averages dataType
  tSeries and vSeries (variance at each time point)

t-test, parMap, over a time window
  how specify the time window

Need a means for adding analysis parameters as needed instead of
always specifying all of them whether or not the are relevant to a
particular dataset.
  Table of analysis param names, defaults, valid values
  Prompt user to choose a value when it is first accessed

Save relevant analysis parameters in corAnal.mat,
Averages/*/tSeries.mat, etc.

Questions for Kalanit:
- I'm confused about how the 2 step event analysis will work. For a
true t-test, need to keep the full stack of tSeries. Just the ave and
SE could be used for a z-test at a single time point but not a t-test
over a window. Dale et al algorithm apparently does the right thing by
computing a covariance matrix as it accumulates the average tSeries.

===========================================================================================
Init:

mrInitRet, GetAnatomy, GetScanParams
slices from inplane & Pfile headers (start/end & thickness)

getRecon, complex recon

doCorrel [done?]

===========================================================================================
Documentation:

===========================================================================================
Notes on stuff that I did not do or did not complete:

clean up file access using fullfile
- XformView/functionals2mrGray
- XformView/volROI2mrGray
- XformView/xformVolumeMenu calls to functionals2mrGray & volROI2mrGray
- Cortmag/mrLVolumeCortMag
- Cortmag/cmagImage-home
- BlockAnalysis/computeTempXCorAnal
- Init/*

mrSESSION.nScans -> numScans(view)
mrSESSION.nSlices -> numSlices(view,scan)
mrSESSION.nFrames -> numFrames(view,scan)
mrSESSION.cropTSeriesSize -> dataSize(view,scan)
etc.
- AnalyzePhaseTSeries
- CombineROIAnalysis
- ComputeAmpMap
- EventAnalysisSession

phase corAnal & complex corAnal need to be (re-)implemented using dataType
grep for phaseFlag

======================================================================================
mrInitRet

============================================================================================
File and directories

check4file(path) vs exist(path,'file')

======================================================================================
Analysis

selectScans uses CountDirs, not numScans. This can cause confusion/inconsistency.

removeBaseline2 is a memory hog

motion compensation, motionComp data type?

vol2flatTSeries: inconsistent number of pixels warning from loadtSeries
because it compares the nPixels in the tSeries file to the image size.
Rewrite this to make it the full size of the flat map with NaNs where there's no data,
like the corAnal matrices.

functions for restricting ROIs to go along with analyzeSessions

=======================================================================================
Edit:

remove scan (e.g., to delete one of the averages)

groupScans

menu user interface to copyScan

dialog interface to set clipMode, from edit menu

=======================================================================================
ROI:

save ROI:
make user edit/append to a comment field

mapVolROIs

addROIpoints bug:
If you add a point that's on remCoords then we need to remove it from remCoords. 

loadROI:
Use ROI's filename to fill it's name field, rather than storing the
name with the ROI.

=======================================================================================
Plots:

across scan plots: what to do if data are missing for one or more scans?

=============================================================================================
Misc:

worry about viewSize vs dataSize vs sliceDims

replace "warning off" with proper logic 
  myGriddata
  recomputeImage

write function to hide converting coordIndices to volIndices
  subCoords = coords(:,subCoordIndices);
  volIndices = coords2Indices(subCoords,viewSize(view));
Currently done in:
  inPhWindow
  aboveCoThresh
  elsewhere?
  
rewrite slider code (to clean up and remove redundancies) 
makeSlider
resetSlider
setSlider
Scan/getCurScan.m       
Scan/initScanSlider.m   
Scan/setCurScan.m
Slice/getCurSlice.m       
Slice/initSliceSlider.m   
Slice/setCurSlice.m

Use matlab's built-in ind2sub and sub2ind instead of indices2Coords
and coords2Indices.  This will be hard because the built-in matlab
functions give an error if the indices or coords are out of range
whereas my functions allow out-of-range values.  So we would have to
check first before calling the matlab functions.
- replace coords2Indices with sub2ind:
  getCurData
  getCurDataROI
  meanTSeries
  cropCurSlice
  xformROIcoords
- replace indices2Coords with ind2sub:
  convertROI
  addROIpoly
  addROIrect
  xformROIcoords

color map dialog from color map menu
set numGrays 
set numColors
set clipMode

document "function groups"
% If you change this function make parallel changes in:
%
%
