% % volOut = EC_radial_MS( imDim, flPxShiftMax, flDuration ) % ------------------------------------------------------------------------- % % Generates an animated triangular motif that is periodic in time, and % piecewise square-wave horizontally and on diagonals. These are the % motifs for the "Mixed symmetries" animated tiling. % % USAGE: volOut = EC_radial_MS( 256, 512, 1.0 ); % % INPUT: % % imDim - One dimension of the resulting square volume. % flPxShiftMax - Proportional to maximum edge shift. Also set appropriate % animation frame rate (see hardcoded nFrameRate). % flDuration - Duration of one cycle of the animation, in pixels/second. % % HARDCODED (immediately below function declaration): % % strStem - File stem naming of output file. % nFrameRate - Expected animation frame rate. % % RETURN VALUES: % % volOut - Grayscale volume array with size % [ imDim x imDim x flDuration*nFrameRate ], % doubles in the range [0.0, 1.0]. % % OUTPUT: % % Writes a Space Type 1 volume to current directory. % % FUNCTION CALLS and DEPENDENCIES: % % Edge_contrast_1D.m % volume_merge_logical_MSBackground.m % write_Space_volume.m % % % Mark Dow, November 12, 2008 % Mark Dow, modified November 22, 2008 (Full cycle animation generation.) % Mark Dow, modified November 22, 2008 (Derived from EC_radial.m.) % % % TERMS FOR USE: There are no restrictions on the use of this code, % auxilliary code and other required resources. Claiming % to be the originator, explicitly or implicitly, is bad % karma. A link (if appropriate), a note to dow[at]uoregon.edu, % and credit are appreciated but not required. % function volOut = EC_radial_MS( imDim, flPxShiftMax, flDuration ) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % hardcoded parameters strStem = 'MS'; strStem = [ strStem '-A' ]; strFilestem = [ strStem '-' num2str(imDim) '_' num2str(flPxShiftMax) '_' num2str(flDuration) ] nFrameRate = 24; flTwist = 5/3.0; % "Mixed symmetries" flPhase = 0/3.0; % "Mixed symmetries" A %flPhase = 1/3.0; % "Mixed symmetries" B %flPhase = 2/3.0; % "Mixed symmetries" C % hardcoded parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% volOut( 1:imDim, 1:flDuration*nFrameRate, 1:imDim ) = 0; nFrames = flDuration*nFrameRate; for iH = 1 : imDim flHalfWidth = round( 2*(iH/imDim)*(flPxShiftMax/4) )/2; nHalfWidth = ceil( flHalfWidth ); for iF = 1 : nFrames volOut( imDim/2 - nHalfWidth + 1 : imDim/2 + nHalfWidth, iF, iH ) ... = Edge_contrast_1D( flHalfWidth, (iF/nFrames + flPhase + 2*flTwist*(iH/imDim))*180 ); end end % figure % imshow( squeeze( volOut(:,1,:) ) ) % colormap(gray) volBackground = flipdim( volOut, 1 ); volBackground( find(volBackground > 0) ) = ( volBackground( find(volBackground > 0) )/1.5 ) - .25; volBackground( find(volBackground < 0.0) ) = 0.0; % length( find( volBackground <=.0001 ) ) % min( volBackground(:) ) % max( volBackground(:) ) volOut = volume_merge_logical_MSBackground( volOut, volBackground ); % min( volOut(:) ) % max( volOut(:) ) write_Space_volume( volOut, [ strFilestem ] );