function dirList = categoryDirs(catName);
% This function returns a cell-of-strings containing directory names
% where images belonging to a desired category can be found. It removes the 
% clutter of having all the possibilties spelled out/commented out at the beginning.
% 
% if an invalid category is specified, it errors.
%
% 10/03 ras.
if ~exist('imageDB','file')
	fprintf('Check your paths -- you need the file imageDB.m. \n');
	return
end

% remove trailing s's -- a crude way to be compatible with plural/singular category specification
if isequal(catName(end),'s')
	catName = catName(1:end-1);
end

switch lower(catName)
case 'animal',
	dirList= { ...
	fullfile(imageDB,'jpgcats') ...
	fullfile(imageDB,'jpgdogs') ...
	fullfile(imageDB,'jpghorse') ...
	fullfile(imageDB,'jpgdonkey') ...
	fullfile(imageDB,'jpgbirds') ...
	fullfile(imageDB,'jpgfish') ...
	};
case {'4leggedanimal','animalnew','newanimal'},
	dirList= { ...
	fullfile(imageDB,'jpgnew4leggedanimals') ...
	};
case {'animalnoface','animalsmallface'},
	dirList= { ...
	fullfile(imageDB,'animalnoface') ...
	};
	
case {'airplane','plane'},
	dirList = { ...
	fullfile(imageDB,'jpgairplanes','fighterjpg') ...
	fullfile(imageDB,'jpgairplanes','planejpg') ...
	fullfile(imageDB,'jpgairplanes','jetjpg') ...
	};
case 'vehicle',
	dirList= [categoryDirs('airplane'); categoryDirs('boat'); categoryDirs('car')];
case 'bird',
	dirList= { ...
	fullfile(imageDB,'jpg_animals','jpgbirds','assortedbirds') ...
	fullfile(imageDB,'jpg_animals','jpgbirds','ducks') ...
	fullfile(imageDB,'jpg_animals','jpgbirds','parrots') ...
	fullfile(imageDB,'jpg_animals','jpgbirds','pigeons') ...
	};	
case 'boat',
	dirList = { ...
	fullfile(imageDB,'jpgboats','assortedboats') ...
	fullfile(imageDB,'jpgboats','motorboats') ...
	fullfile(imageDB,'jpgboats','sailboats') ...
	};
case 'cat',
	dirList = { ...
	fullfile(imageDB,'jpgcats','jpghousecat') ...
	fullfile(imageDB,'jpgcats','jpgassortedcat') ...
	};
case 'car',
	dirList = { ...
	fullfile(imageDB,'jpgcar_noBG') ...
	};
case 'dog',
	dirList= { ...
	fullfile(imageDB,'jpgdogs') ...
	};
case 'face',
	dirList= { ...
	fullfile(imageDB,'jpgfaces','man') ...
	fullfile(imageDB,'jpgfaces','woman') ...
	fullfile(imageDB,'jpgfaces','child') ...
	};
case {'man','male','men'}
	dirList= { ...
	fullfile(imageDB,'jpgfaces','man') ...
	};
case {'female','woman','women'}
	dirList= { ...
	fullfile(imageDB,'jpgfaces','woman') ...
	};
case {'child'}
	dirList= { ...
	fullfile(imageDB,'jpgfaces','child') ...
	};
case 'donkey',
	dirList= { ...
	fullfile(imageDB,'jpgdonkey') ...
	};	
case {'famous'}
	dirList= { ...
	fullfile(imageDB,'jpgfaces','brad') ...
	fullfile(imageDB,'jpgfaces','cindy') ...
	fullfile(imageDB,'jpgfaces','claudia') ...
	fullfile(imageDB,'jpgfaces','harrisonford') ...
	fullfile(imageDB,'jpgfaces','julia') ...
	};
case 'feline',
	dirList= { ...
	fullfile(imageDB,'jpgcats','jpghousecat') ...
	fullfile(imageDB,'jpgcats','jpgassortedcat') ...
	fullfile(imageDB,'jpgcats','jpglion') ...
	};	
case 'fish',
	dirList= { ...
	fullfile(imageDB,'jpg_animals','jpgfish','assortedfish') ...
	fullfile(imageDB,'jpg_animals','jpgfish','jpgshark') ...
	};
case {'boat+car','boats+car','car+boat','cars+boat'},
	dirList = [categoryDirs('boat') categoryDirs('car')];
case 'horse',
	dirList= { ...
	fullfile(imageDB,'jpghorse') ...
	};
case 'anim+vehicle',
	dirList= [categoryDirs('bird+fish') categoryDirs('vehicle')];
case {'bird+fish','birds+fish'},
	dirList= [categoryDirs('bird') categoryDirs('fish')];
case 'instrument',
	dirList = { ...
	fullfile(imageDB,'jpg_musical','jpgbrass') ...
	fullfile(imageDB,'jpg_musical','jpgsaxophone') ...
	fullfile(imageDB,'jpg_musical','jpgtrumpet') ...
	fullfile(imageDB,'jpg_musical','jpgguitars') ...
	fullfile(imageDB,'jpg_musical','strings') ...
	fullfile(imageDB,'jpg_musical','jpgpianos','assorted_jpg') ...
	fullfile(imageDB,'jpg_musical','jpgpianos','grand_jpg') ...
	fullfile(imageDB,'jpg_musical','jpgpianos','upright_jpg') ...
	};
case 'scene',
	dirList = { ...
	fullfile(imageDB,'bwscenes') ...
	};
case 'house',
	dirList = { ...
	fullfile(imageDB,'jpghouses','all') ...
	};
case {'line','Dave'},
	dirList = { ...
	fullfile(imageDB,'jpgline','uni_stim_15') ...
	fullfile(imageDB,'jpgline','uni_stim_105') ...
	fullfile(imageDB,'jpgline','vehicle','car') ...
	fullfile(imageDB,'jpgline','animal','mammal') ...
	fullfile(imageDB,'jpgline','linefaces') ...
	fullfile(imageDB,'jpgline','animal','dinosaur') ...
	};
case {'lineface'},
	dirList = { ...
	fullfile(imageDB,'jpgline','linefaces') ...
	};
case {'linecar'},
	dirList = { ...
	fullfile(imageDB,'jpgline','vehicle','car') ...
	};
case {'linevehicle'},
	dirList = { ...
	fullfile(imageDB,'jpgline','vehicle','car') ...
	fullfile(imageDB,'jpgline','vehicle') ...
	};	
case {'lineanimal'},
	dirList = { ...
	fullfile(imageDB,'jpgline','animal','mammal') ...
	fullfile(imageDB,'jpgline','animal','dinosaur') ...
	};
case {'linedino','linedinosaur'},
	dirList = { ...
	fullfile(imageDB,'jpgline','animal','dinosaur') ...
	};
case {'linemammal'},
	dirList = { ...
	fullfile(imageDB,'jpgline','animal','mammal') ...
	};
case {'linescrambled'},
	dirList = { ...
	fullfile(imageDB,'jpgline','scrambled') ...
	};
case {'linesubset','linesubset32','subset32'},
	dirList = { ...
	fullfile(imageDB,'jpgline','subset32','face') ...
	fullfile(imageDB,'jpgline','subset32','vehicle') ...
	fullfile(imageDB,'jpgline','subset32','animal') ...
	};
case {'subset32face'},
	dirList = { ...
	fullfile(imageDB,'jpgline','subset32','face') ...
	};
case {'subset32vehicle'},
	dirList = { ...
	fullfile(imageDB,'jpgline','subset32','vehicle') ...
	};
case {'subset32animal'},
	dirList = { ...
	fullfile(imageDB,'jpgline','subset32','animal') ...
	};
case {'subset32abstract'},
	dirList = { ...
	fullfile(imageDB,'jpgline','subset32','abstract') ...
	};
case {'subset32scrambled'},
	dirList = { ...
	fullfile(imageDB,'jpgline','subset32','scrambled') ...
	};
case {'subset12face'},
	dirList = { ...
	fullfile(imageDB,'jpgline','subset12','face') ...
	};
case {'subset12vehicle','subset12car'},
	dirList = { ...
	fullfile(imageDB,'jpgline','subset12','car') ...
	};
case {'subset12animal'},
	dirList = { ...
	fullfile(imageDB,'jpgline','subset12','animal') ...
	};
case {'subset12scrambled'},
	dirList = { ...
	fullfile(imageDB,'jpgline','subset12','scrambled') ...
	};
case {'sculpt','sculpture','abstract','novel'}
	dirList = { ...
	fullfile(imageDB,'jpgsculpt_noBG') ...
	};
% 	fullfile(imageDB,'jpgsculpt_rastemp') ...
case {'coarsescrambled','scrambledcoarse'}
	dirList = { ...
    fullfile(imageDB,'roryscrambledcoarse') ...
	};
case {'texture','scrambled'}
	dirList = { ...
    fullfile(imageDB,'roryscrambledfine') ...
	};
% 	fullfile(imageDB,'SCRAMBLED_JPG') ...
% 	fullfile(imageDB,'jpgtextures') ...
otherwise,
	error('Invalid category specified.');
	return
end

% check that all the specified dirs exist
i = 1;
while i <= length(dirList)
	if ~exist(dirList{i},'dir')
		fprintf('categoryDirs: dir %s not found, removing from list.\n',dirList{i});
		dirList = {dirList{1:i-1} dirList{i+1:end}};
	end
	i = i + 1;
end

% looks nicer as a column vector 
dirList = dirList(:);

return
