function success = openThisDataSet(datasetnum, windowWidth, windowHeight) %last two args are optional, and assume the measurement is in pixels %structuredShowmesmallMain does some initial setup, then %calls this function. Pressing 'v' calls this function directly %this main function uses the following functions: % clickMapCallback, clickCallback, similarityClick % adjacencyClickCycling, adjacencyClick, keyPressCallback % (kpcb uses allBackOn), % makeNewWindowWithVisible, getNextFigNum, % myFigureCloseRequest, ... % after set up also calls: createWindowDisplayWithCoords, createFigureInfoWindow global theVars; global nextFigNum; global freedFigNums; global menubarheight; global scrollbarwidth; global bottompadding; %to make sure the images aren't clipped by the window global openDataSets; success = 1; %assume all is well at first %establish window number myFigNum=getNextFigNum; %ensures non-corruption of nextFigNum if(isempty(openDataSets)) openDataSets(1).dataSetNum = datasetnum; openDataSets(1).figNums = [myFigNum]; else datasetindex = find(cat(1,openDataSets.dataSetNum)==datasetnum); if(isempty(datasetindex)) openDataSets(end+1,1).dataSetNum = datasetnum; openDataSets(end,1).figNums = [myFigNum]; %end--> we've already added a row else openDataSets(datasetindex,1).figNums(1,end+1) = myFigNum; end; end; theVars(myFigNum).coordsHighlightIndex=1; %used by findElementWindow theVars(myFigNum).isFocused=0; theVars(myFigNum).currentCellFocus=0; theVars(myFigNum).currCellFocusName=''; theVars(myFigNum).clickBehaviorChar= 's'; %starts in 'similarity mode' by default theVars(myFigNum).clickLevelNum=1; %default is a subgraph 1 level deep theVars(myFigNum).allIndicesExpanded=[]; %clear theVars(myFigNum).allIndicesDisplayed=[]; %clear theVars(myFigNum).theAxesHandles=[]; %clear theVars(myFigNum).theRelSimilarityMatrix = []; %clear theVars(myFigNum).theAbsSimilarityMatrix = []; %clear theVars(myFigNum).theRel2SimilarityMatrix = []; %clear theVars(myFigNum).theFullRelSimilarityMatrix = []; theVars(myFigNum).theFullAbsSimilarityMatrix= []; theVars(myFigNum).theFullRel2SimilarityMatrix= []; theVars(myFigNum).theRelSimSimMatrix = []; theVars(myFigNum).theAbsSimSimMatrix = []; theVars(myFigNum).theRel2SimSimMatrix = []; theVars(myFigNum).theFullRelSimSimMatrix = []; theVars(myFigNum).theFullAbsSimSimMatrix = []; theVars(myFigNum).theFullRel2SimSimMatrix = []; theVars(myFigNum).names={}; theVars(myFigNum).targets = []; %theVars(myFigNum).targetNames={}; theVars(myFigNum).basecolor=0.9*[1 1 1]; %used by colorhinton theVars(myFigNum).visThreshold=0.99; %----*****default THRESHOLD*****---------- theVars(myFigNum).thresholdTesters=[]; %load the data-- assume ROWS are data elements %helper function: loadInputData.m [data,origData]=loadVerbInputDatasms(datasetnum,myFigNum); if(isempty(data)) success = 0; return;%EXIT-->invalid dataset end; %targetNames are currently unused %theVars(myFigNum).targetNames = textread('../verbs/classes','%s\n'); numinputs = size(data,1); theVars(myFigNum).lastValidDataIndex=numinputs; theVars(myFigNum).origNuminputs = numinputs; %for spawning theVars(myFigNum).allOrigData = origData; %the feature vectors theVars(myFigNum).numrows = ceil(sqrt(numinputs)); theVars(myFigNum).numcols = theVars(myFigNum).numrows; theVars(myFigNum).origNumrows=theVars(myFigNum).numrows;%for spawning theVars(myFigNum).origNumcols=theVars(myFigNum).numcols;%for spawning theVars(myFigNum).rowColSpanInOrig=[1,theVars(myFigNum).numrows,1,theVars(myFigNum).numcols];%for spawning theVars(myFigNum).myDataSetNum = datasetnum; %helper function: determineSizingsms.m %SETS theVar(myFigNum).foo, for foo= {mytitlefontsize, %desiredlinewidth, highlightWidth, desirednumpixelspersubcell, %desirednumpixelsperpadding, desiredheight, desiredwidth} if(nargin == 1) determineSizingsms(myFigNum); else determineSizingsms(myFigNum, windowWidth, windowHeight); end; %datasize dependant initialization theVars(myFigNum).latestSimilarityRanking=zeros(numinputs,2); %initialize to empty theVars(myFigNum).lsrIndex=numinputs; % to loop BACKWARDS through the lsr list theVars(myFigNum).nameHandles=zeros(numinputs,1); %create an appropriate color assignment assoc with each input %helper function: makeColorValuesMatrix.m theVars(myFigNum).borderColors = makeColorValuesMatrix(theVars(myFigNum).numrows,theVars(myFigNum).numcols); theVars(myFigNum).patchColors = theVars(myFigNum).borderColors; %NOTE: patchColors never changes, but the borderColors matrix %shrinks when a new subwindow is spawned %finally, create the relSimilarity and absSimilarity matrices [rsim, asim, r2sim]=calcSimilaritiesInOrigData(origData); %NOTE: theFull{Abs}RelSimilarityMatrix never changes, but the non-'Full' matrices %shrink when a new subwindow is spawned theVars(myFigNum).theRelSimilarityMatrix=rsim; theVars(myFigNum).theAbsSimilarityMatrix=asim; theVars(myFigNum).theRel2SimilarityMatrix=r2sim; theVars(myFigNum).theFullRelSimilarityMatrix=rsim; theVars(myFigNum).theFullAbsSimilarityMatrix=asim; theVars(myFigNum).theFullRel2SimilarityMatrix=r2sim; %createRecursiveSimTables [rsimsim, asimsim, r2simsim]=calcSimilaritiesInSimData(myFigNum); theVars(myFigNum).theRelSimSimMatrix = rsimsim; theVars(myFigNum).theAbsSimSimMatrix = asimsim; theVars(myFigNum).theRel2SimSimMatrix = r2simsim; theVars(myFigNum).theFullRelSimSimMatrix = rsimsim; theVars(myFigNum).theFullAbsSimSimMatrix = asimsim; theVars(myFigNum).theFullRel2SimSimMatrix = r2simsim; theVars(myFigNum).simMode = 2; %pearson's r theVars(myFigNum).fni = 1; %make sure we're using the right names!! %simModes 1,2,3 use fni 1, but the recursive modes (4,5,6) use fni 2 %pad the data with placeholders if numinputs is not a perfect square %data=rsim; %uncomment and correct this line if using something %other than simMode 2 (pearson) to start extras=theVars(myFigNum).numrows^2-numinputs; data = [data,repmat(0,numinputs,extras);... repmat(0,extras,numinputs+extras)]; theVars(myFigNum).outofboundsIndexList = numinputs+[1:extras]; theVars(myFigNum).inboundsIndexes = [1:numinputs]; %!!!!!!!make sure 2nd last arg is the dataset corresponding to %simMode, and has been PADDED with 0's as needed createWindowDisplayWithCoords(myFigNum,1,theVars(myFigNum).numrows,... 1,theVars(myFigNum).numcols,data,0); createFigureInfoWindow(myFigNum, datasetnum); %for user feedback clear data origData; %we've saved this into our data struct clear rsim asim r2sim rsimsim asimsim r2simsim;