Doxygen Source Code Documentation
PrefixStatus.m
Go to the documentation of this file.00001 function [Status, Prefix, View] = PrefixStatus (Prefix)
00002 %
00003 % [Status, Prefix, View] = PrefixStatus (Name)
00004 %
00005 %Purpose:
00006 % Determines if the name chosen is a valid for an AFNI Brick
00007 % If you pass a name containing prefix only and no view then
00008 % View is assumed to be +orig
00009 %
00010 %
00011 %Input Parameters:
00012 % Name: a string containing an AFNI Prefix,
00013 % or Prefix and view moon+orig or
00014 % Prefix, view and extension moon+acpc.HEAD
00015 %
00016 %
00017 %
00018 %Output Parameters:
00019 % Status : -1 error
00020 % : 0 Read Only
00021 % : 1 Read|Write
00022 % Prefix: The Prefix
00023 % View: The view, if found
00024 %
00025 %Key Terms:
00026 %
00027 %More Info :
00028 %
00029 % The function checks for the existence of a brick with a similar
00030 % prefix
00031 %
00032 %
00033 % Author : Ziad Saad
00034 % Date : Wed Sep 19 10:30:05 EDT 2001
00035 % SSCC/NIMH/ National Institutes of Health, Bethesda Maryland
00036
00037
00038 %Define the function name for easy referencing
00039 FuncName = 'PrefixStatus';
00040
00041 %Debug Flag
00042 DBG = 1;
00043
00044 %initailize return variables
00045 Status = 0;
00046 View = '';
00047
00048 %make sure you have no HEAD or BRIK as an extension
00049 [Prefix, Ext] = RemoveExtension(Prefix, '.HEAD|.BRIK');
00050
00051 %make sure you have no view
00052 [Prefix, ViewName] = RemoveExtension(Prefix, '+orig|+acpc|+tlrc');
00053
00054 %check for conflict
00055 if (~isempty(Ext) & isempty(ViewName)),
00056 Status = -1;
00057 ErrEval(FuncName,'Err_Expected a correct view (+orig, +acpc or +tlrc) but found none.');
00058 return;
00059 end
00060
00061 if (~isempty(ViewName)), View = ViewName; else View = '+orig'; end
00062
00063 %look for various files
00064 if (exist(sprintf('%s%s.HEAD', Prefix, View)) == 2), return; end
00065 if (exist(sprintf('%s%s.BRIK', Prefix, View)) == 2), return; end
00066
00067
00068
00069
00070 Status = 1;
00071 return;
00072