<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Robert Harder &#187; PhD</title>
	<atom:link href="http://blog.iharder.net/category/phd/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.iharder.net</link>
	<description>Think Harder, not smarter</description>
	<lastBuildDate>Sun, 02 Oct 2011 05:41:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Eye Track Visualization with Scalable Vector Graphics</title>
		<link>http://blog.iharder.net/2009/03/30/eye-track-visualization-with-scalable-vector-graphics/</link>
		<comments>http://blog.iharder.net/2009/03/30/eye-track-visualization-with-scalable-vector-graphics/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 15:32:12 +0000</pubDate>
		<dc:creator>Robert Harder</dc:creator>
				<category><![CDATA[PhD]]></category>

		<guid isPermaLink="false">http://robertharder.wordpress.com/?p=12</guid>
		<description><![CDATA[A friend of mine Patrick Jungkunz (German Navy) is doing some research that involves gathering eye track data as participants look for hostile forces in a computer-generated urban battle scene, and I thought that being able to play back the data would be helpful. It was time to dust off the old XML/XSL skills and [...]]]></description>
			<content:encoded><![CDATA[<p class="paragraph_style">A friend of mine Patrick Jungkunz (German Navy) is doing some research that involves gathering eye track data as participants look for hostile forces in a computer-generated urban battle scene, and I thought that being able to play back the data would be helpful.  It was time to dust off the old XML/XSL skills and brush up on Scalable Vector Graphics (SVG), an XML-based graphics format that also supports animated elements (actually, I first thought I’d use SMIL, a multimedia format that seemed perfect for this, but I found better SVG support in my tool chain).</p>
<p style="text-align:center"><iframe width="420" height="345" src="http://www.youtube.com/embed/LpYzA0AapNQ" frameborder="0" allowfullscreen></iframe></p>
<p><span id="more-12"></span></p>
<p class="paragraph_style">
<p class="paragraph_style">You can download the XML, XSL, and SVG files below or an MPEG-4 video capture of Safari rendering the SVG animation. If you want to try the SVG file itself, you’ll need a fairly capable browser. At the time of this writing, only <a title="http://www.apple.com/safari" href="http://www.apple.com/safari">Safari 4</a> and Opera 9 had sufficient SVG support.</p>
<p class="paragraph_style" style="text-align: center;"><a href="http://blog.iharder.net/wp-content/uploads/2009/03/0003_par14_part3.svg">Click to view SVG file in your browser</a></p>
<p class="paragraph_style" style="text-align: center;"><a href="http://blog.iharder.net/wp-content/uploads/2009/03/eyetrack.mp4">Click to view MPEG-4 screen capture of SVG animation</a></p>
<p class="paragraph_style" style="text-align: center;"><a href="http://blog.iharder.net/wp-content/uploads/2009/03/eyetrack.zip">Click to download source material (zipped)</a></p>
<p class="paragraph_style">
<h2>Python-Pickled Raw Data</h2>
<p class="paragraph_style">My friend processed the raw data collected by the commercial eye tracker for his own analysis and stored the data in a Python pickle (*.pkl) file, a sort of internal serialization of Python objects to disk.  My first step was to convert the data to XML, and I feared I would have to invent some sort of <span class="style">ad hoc</span>tagging system for notating eye track data, fixations (lingering on a position), and where the participant clicked when detecting a bad guy.  Fortunately I found the <a title="http://www.xml.com/cs/user/view/cs_msg/780" href="http://www.xml.com/cs/user/view/cs_msg/780">gnosis.xml.pickle</a> package which let me convert each standard pickle file to an XML pickle file with two lines, where <span class="style_1">fin</span> and <span class="style_1">fout</span> are two files (input and output) opened with standard Python <span class="style_1">file(..)</span> commands:</p>
<pre>x = pickle.load(fin)
gnosis.xml.pickle.dump(x,fout)</pre>
<p class="paragraph_style">
<p class="paragraph_style">Since the original Python object that was serialized was an array of arrays (of arrays…) of data, the XML-pickled file also had these characteristics:</p>
<pre>&lt;?xml version="1.0"?&gt;
&lt;!DOCTYPE PyObject SYSTEM "PyObjects.dtd"&gt;
&lt;PyObject family="obj" type="builtin_wrapper"  class="_EmptyClass"&gt;
&lt;attr name="__toplevel__" type="list" id="330168" &gt;
  &lt;item type="string" value="0003" /&gt;
  &lt;item type="numeric" value="1228326236401." /&gt;
  &lt;item type="string" value="1228326251632" /&gt;
  &lt;item type="list" id="514168" &gt;
    &lt;item type="list" id="412728" &gt;
      &lt;item type="string" value="hit" /&gt;
      &lt;item type="string" value="1228326240170" /&gt;
      &lt;item type="string" value="351.000000" /&gt;
      &lt;item type="string" value="527.000000" /&gt;
    &lt;/item&gt;
    &lt;item type="list" id="2443064" &gt;
      &lt;item type="string" value="hit" /&gt;
      &lt;item type="string" value="1228326243357" /&gt;
      &lt;item type="string" value="776.000000" /&gt;
      &lt;item type="string" value="654.000000" /&gt;
    &lt;/item&gt;
...</pre>
<p>You can begin to imagine the format of the data, with scene identifications (0003), time stamps, and x/y coordinates of where a click took place. Here is the definition provided by my friend. It requires a little reading between the lines.</p>
<pre>sceneL ::= [ scene ]
scene ::= [sceneName, startTime, endTime, actions,
  gazes,fixations]
actions ::= [action]
gazes ::= [gaze]
gaze ::= [frame number, gmt seconds, gmt milliseconds,
  saccade flag, gaze pixel location X, gaze pixel
  location Y, velocity, acceleration, jerk]
fixations = [fixation]
fixation = [x,y,start,end]</pre>
<p class="paragraph_style">
<h2>Using XSL to Transform XML to SVG</h2>
<p>Let me just take a moment to say that although XML and XSL were supposed to bring us some kind of unity with data with organs making reverential sounds in the background, I’ve never actually had XML live up to its promise the way it has with this project.</p>
<p>Before processing individual eye track points, I needed to collect some overall data about the scene (like duration) and establish some parameters to use over and over again (like colors). The <span class="style_1">xsl:variable</span> tag proved invaluable here, and I was able to do basic math on the time stamps provided in the pickle data. Incidentally, since this isn’t an XSL tutorial, I’m going to skip some of the basics like the header line of an XSL file and talk instead about the more interesting parts. Feel free to refer to the actual files (available for download from the link at the beginning of the post) for all the gory details.</p>
<p class="paragraph_style">Here are some of the <span class="style_1">xsl:variable</span> tags used at the beginning of the document:</p>
<pre>&lt;xsl:variable
  name="START_MILLIS"
  select="/PyObject/attr/item[2]/@value"/&gt;
&lt;xsl:variable
  name="END_MILLIS"
  select="/PyObject/attr/item[3]/@value"/&gt;
&lt;xsl:variable
  name="DURATION_MILLIS"
  select="$END_MILLIS - $START_MILLIS"/&gt;
&lt;xsl:variable
  name="DURATION_SECONDS"
  select="$DURATION_MILLIS * 0.001"/&gt;
...</pre>
<p class="paragraph_style">
<p class="paragraph_style">You can see that XPath is sufficient to reference the Python pickled arrays by position (XPath is one-indexed, not zero-indexed). The <span class="style_1">START_MILLIS</span> and <span class="style_1">END_MILLIS</span> data is boldfaced in the data extract above. Note that although Python thought one of the data values was numeric and one was a string, it did not adversely affect us since XSL coerced the string into a number when it calculated the <span class="style_1">DURATION_MILLIS</span> variable.</p>
<p class="paragraph_style">
<h2>Root Node</h2>
<p class="paragraph_style_2">I establish the first <span class="style_1">xsl:template</span> node that matches the pickled XML document root (/).</p>
<pre>&lt;!-- Root Node --&gt;
&lt;xsl:template match="/"&gt;
  &lt;!-- Root SVG Element --&gt;
  &lt;s:svg version="1.0"&gt;
    &lt;xsl:attribute name="width"&gt;
      &lt;xsl:value-of select="$WIDTH"/&gt;
    &lt;/xsl:attribute&gt;
    &lt;xsl:attribute name="height"&gt;
      &lt;xsl:value-of select="$HEIGHT"/&gt;
    &lt;/xsl:attribute&gt;
...</pre>
<p class="paragraph_style">
<p class="paragraph_style">You’ve got to love the <span class="style_1">xsl:attribute</span> tag that lets you dynamically add attributes to nodes so easily. OK, it could be easier if it had a <span class="style_1">select</span> attribute, but what are you going to do? Come to think of it, why <span class="style">doesn’t</span> it have a <span class="style_1">select</span> attribute? If you’re assigning an attribute value, it’s not like you’re going to stick a whole XML node in there!</p>
<p class="paragraph_style">
<div class="paragraph paragraph_style_2">
<div class="tinyText style_SkipStroke_2 inline-block stroke_2">
<h2>Eye Tracks</h2>
</div>
</div>
<p class="paragraph_style">Let’s jump to where we want to start showing individual eye tracks, represented by faint blue circles in the final image.</p>
<pre>    &lt;xsl:comment&gt;Eye Tracks - Persistent&lt;/xsl:comment&gt;
    &lt;xsl:apply-templates
      select="/PyObject/attr/item[5]/item"/&gt;</pre>
<p class="paragraph_style">
<p class="paragraph_style">Nice and clean, we just call <span class="style_1">xsl:apply-templates</span> and pass in the array of items representing the tracks. The Python Gnosis XML pickling is a little funny in that you end up with what seems like extra <span class="style_1">item</span> tags, but it’s quite consistent and easy to figure out.</p>
<p class="paragraph_style">Further down we have the entire eye track template. Note how we match the same XPath statement that we’re passing.</p>
<pre>&lt;!-- Eye Tracks (Gaze) --&gt;
&lt;xsl:template match="/PyObject/attr/item[5]/item"&gt;
  &lt;xsl:variable
    name="frame"
    select="./item[1]/@value"/&gt;
  &lt;xsl:variable
    name="beginMillis"
    select="./item[2]/@value*1000 + ./item[3]/@value"/&gt;
  &lt;xsl:variable
    name="begin"
    select="($beginMillis - $START_MILLIS) * 0.001" /&gt;
  &lt;xsl:variable name="x" select="./item[5]/@value"/&gt;
  &lt;xsl:variable name="y" select="./item[6]/@value"/&gt;
  &lt;s:g display="none" shape-rendering="optimizeSpeed"&gt;
    &lt;s:set attributeType="CSS"
      attributeName="display" to="block" &gt;
      &lt;xsl:attribute name="begin"&gt;
        &lt;xsl:value-of select="$begin"/&gt;
      &lt;/xsl:attribute&gt;
    &lt;/s:set&gt;
    &lt;s:animate attributeType="CSS"
      attributeName="opacity"
      from="1" to="0" dur="0.2s"&gt;
      &lt;xsl:attribute name="begin"&gt;
        &lt;xsl:value-of select="$begin"/&gt;
      &lt;/xsl:attribute&gt;
    &lt;/s:animate&gt;
    &lt;s:circle r="6" opacity="0.1"&gt;
      &lt;xsl:attribute name="fill"&gt;
        &lt;xsl:value-of select="$GAZE_COLOR" /&gt;
      &lt;/xsl:attribute&gt;
      &lt;xsl:attribute name="cx"&gt;
        &lt;xsl:value-of select="$x"/&gt;
      &lt;/xsl:attribute&gt;
      &lt;xsl:attribute name="cy"&gt;
        &lt;xsl:value-of select="$y"/&gt;
      &lt;/xsl:attribute&gt;
    &lt;/s:circle&gt;
  &lt;/s:g&gt;
&lt;/xsl:template&gt;</pre>
<p class="paragraph_style">
<p class="paragraph_style">We initially make the circles invisible by setting the <span class="style_1">display</span> property to <span class="style_1">none</span>.  The timestamp associated with each track determines when we make the circle visible by setting the <span class="style_1">display</span>property to <span class="style_1">block</span>. This is a CSS property, so <span class="style_1">none</span> and <span class="style_1">block</span> may be familiar to you if you’ve used CSS before. We use the SVG tag <span class="style_1">s:set</span> to change a value at a point in time.</p>
<p class="paragraph_style">Similar to <span class="style_1">s:set</span> is <span class="style_1">s:animate</span> which makes changes to a value <span class="style">over time</span> as opposed to <span class="style">instantly</span>. The circle will fade in opacity from 100% (1) to 0% (0) over a period of 0.2 seconds. This has the effect that a circle appears brightly and then fades into the background. Because the circle’s <span class="style_1">opacity</span> is set to 0.1 in the line <span class="style_5">&lt;s:circle r=&#8221;6&#8243; opacity=&#8221;</span><span class="style_6">0.1</span><span class="style_5">&#8220;&gt;</span>, that is the value to which the circle will return at the end of the animation. The animation should probably go from 1 to 0.1 instead of 1 to 0 but the difference is hardly noticeable.</p>
<p class="paragraph_style">To help the eye follow the appearing circles, I also make a single circle that moves from point to point, and the SVG engine will interpolate the positions. See the source code for that one.</p>
<p class="paragraph_style">
<h2>More</h2>
<p class="paragraph_style">Check out the XSL in the source download above for complete details. Also there are more examples here: <a href="http://www.movesinstitute.org/~rharder/eye/">http://www.movesinstitute.org/~rharder/eye/</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.iharder.net/2009/03/30/eye-track-visualization-with-scalable-vector-graphics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://blog.iharder.net/wp-content/uploads/2009/03/eyetrack.mp4" length="425696" type="video/mp4" />
		</item>
		<item>
		<title>Initial Thoughts: 3D via the web</title>
		<link>http://blog.iharder.net/2009/01/20/initial-thoughts-3d-via-the-web/</link>
		<comments>http://blog.iharder.net/2009/01/20/initial-thoughts-3d-via-the-web/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 22:09:02 +0000</pubDate>
		<dc:creator>Robert Harder</dc:creator>
				<category><![CDATA[PhD]]></category>

		<guid isPermaLink="false">http://robertharder.wordpress.com/?p=3</guid>
		<description><![CDATA[Thanks to inspiration at the 2008 I/ITSEC event, I found what I think will be a good dissertation topic for me. I’m interested in the 3D worlds, especially with how we keep reinventing the wheel. It occurred to me that we’re sort of repeating some previous computer history: First we had BBSes; then we had [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align:left;">
<p class="paragraph_style">
<p><img class="size-full wp-image-63 alignright" title="ittsec09" src="http://blog.iharder.net/wp-content/uploads/2009/01/shapeimage_3.png" alt="ittsec09" width="96" height="96" />Thanks to inspiration at the <a title="http://www.iitsec.org/" href="http://www.iitsec.org/">2008 I/ITSEC event</a>, I found what I think will be a good dissertation topic for me. I’m interested in the 3D worlds, especially with how we keep reinventing the wheel.  It occurred to me that we’re sort of repeating some previous computer history: First we had BBSes; then we had Compuserve, America On Line, and others; then we the web. Similarly we had 3D games that interconnected (like BBSes), now we have massive 3D social worlds (like America On Line), but where are we going with it. Are we doomed to publish our 3D content only via Second Life?<span id="more-4"></span></p>
<p class="paragraph_style">Below is the text of what I wrote up about my idea as well as the source PDF.</p>
<p class="paragraph_style" style="text-align:center;">PDF: <a href="http://blog.iharder.net/wp-content/uploads/2009/01/3dviaweboverview.pdf">3DViaWebOverview.pdf</a></p>
<p style="text-align:center;"><strong>3D via the Web and the New WWW:  World Within World<br />
<span style="font-weight:normal;">Robert Harder, Naval Postgraduate School, rharder@nps.edu<br />
January 20, 2009 </span></strong></p>
<h2><strong>Abstract </strong></h2>
<p>From sparsely connected bulletin board systems to monolithic online services like America On Line, we broke the mold when we embraced the world wide web as the medium where anyone could publish content as they saw ﬁt. 3D worlds also moved from connected ﬁrst person shooter games to monolithic 3D social worlds. Now the architecture is almost entirely in place for anyone to publish 3D content as rich or as lean as the imagination allows.</p>
<h2><strong>From Bulletin Boards to the World Wide Web </strong></h2>
<p>When we were ﬁrst learning to interact with people on remote computers there were Bulletin Board Systems (BBS) where users who were close geographically (or could aﬀord long distance phone calls) dialed in and exchanged email, ideas, and ﬁles. Many of these BBSes were successfully linked to each other by Fidonet and other services to exchange data.</p>
<p>Eventually companies poured money into systems to build major cross-country and international worlds such as Compuserve, Prodigy, and America On Line. These successful online communities were isolated from each other, but they provided users with impressive and appreciated content. The content was provided by 1) the service itself, 2) customers paying for space, and 3) the community of users.</p>
<p>When the World Wide Web ﬁrst came on the scene, enabled by the Hyper- Text Transfer Protocol (HTTP) and HyperText Markup Language (HTML), there was not enough content available to entice people to switch from their on- line provider to this new medium, but then individuals and companies realized that they could publish content and provide a virtual presence without having to go through the stove piped providers. Anyone with a web server could have complete control over what visitors saw when they visited a site.</p>
<p>Since those early web days, new capabilities, such as dynamic HTML, script- ing, and new realizations, such as scripts both making their own connections and modifying pages dynamically (commonly referred to as Web 2.0), new classes of applications have arisen and user expectations have grown. Users want rich, interactive content. They expect to see who is online and what their friends are doing. Social networks and collaboration tools connect users synchronously and let them coordinate on shared data. They also want immersive 3D worlds.</p>
<h2><strong>From 3D Games to World Within World </strong></h2>
<p>When users ﬁrst learned to interact in 3D worlds, gaming companies connected their customers to online communities, usually in the form of “ﬁrst person shooter” games. Although Game A from one company could not talk to Game B from another, the experience was new and exciting and led to a boom in the gaming industry. As with the BBSes of old, participants could interact with others of similar interests—namely, the game they were playing. While few companies embraced talking across games as with the Fidonet of yesteryear, the United States military forced its vendors to provide simulations that could talk in a common language to avoid the dreaded “lock-in.” (These simulations use two protocols known as Distributed Interactive Simulation (DIS) and High Level Architecture (HLA) to try to ensure Simulation A from one company can talk to Simulation B from another).</p>
<p>Soon companies began investing signiﬁcant resources into becoming the next Compuserve or America On Line in the social, 3D world. Now individuals and companies can exchange real money for virtual money, purchase “land” in a provider’s virtual world, and build it up within the conﬁnes of that company’s architecture. Again these provide users with impressive and appreciated con- tent, and the content is again provided by 1) the service itself, 2) customers paying for space, and 3) the community of users.</p>
<p>These 3D world providers oﬀer what might be considered an irreplaceable side eﬀect of moving to a 3D world that models reality: they are the brokers who decide that this piece of land “belongs” to this customer and that land to another. If we miss the sleight of hand, we might think that we are stuck with this model.</p>
<p>There is already another model for taking control of our own content and publishing as rich or as lean an experience as we can imagine. It is the World Wide Web, and the new WWW is World Within World.</p>
<h2><strong>World Within World Real Estate </strong></h2>
<p>Instead of tying oneself to a single “world” where everyone is vying for a piece of it, one can publish a world that links to others as the current web does. The architecture is right under our noses and is almost entirely ready to execute.</p>
<p>From a hyperlink in either kind of WWW a user could connect to an immersive 3D world just as easily as loading a traditional web page. Depending on the sophistication of the 3D site, users might click on doors (one of several apt metaphors for the new hyperlink) to move to a new room or they might move from one room or ﬁeld to another as content is dynamically paged in, just as successful Web 2.0 sites do now. A door might lead to another area of the same site or to another site altogether—a World Within World.</p>
<p>The original architects of the web gave us HTTP and HTML, and now there is X3D, which is the World Wide Web Consortium’s (W3C) standard for 3D modeling and a good start for 3D markup. The social networks learned the algorithms for connecting friends with common interests. The online forums learned how to report who is live and online in real time. The Web 2.0 crowd learned how to interact dynamically with content and report back to a host server. HTML 5 even proposes server-side event generation to more easily enable live data feeds—a boon for companies wishing their 3D presence to include a reﬂection of other users in the system.</p>
<h2><strong>Your Presence in a World Within World </strong></h2>
<p>In the simplest case, a user’s avatar (their presence embodied in the 3D world) might not see any other humans except those provided by the hosting site, possibly driven by cognitive models to resemble real human behavior. A social networking site however might reﬂect back to the user others who are in a room of interest. And who says avatars have to resemble uglier versions of ourselves? If an avatar is also just another bit of markup, the artistic among us can build designer bodies that can go with us from world to world. In some worlds a user’s avatar may not be humanoid at all. A ﬂight simulator could instead become a World Within World browser with your favorite airplane being your avatar. A fantasy world might have dragon avatars as easily as knights.</p>
<p>Content providers have complete control over what their world looks like and how a user interacts with it. Will you provide training to employees or recruit new people? Will you show oﬀ 3D models of products in your retail store? Will you let users try on clothes on their designer avatar bodies? Will you be a portal to other worlds, oﬀering users a 3D Main Street experience?</p>
<h2><strong>What Are We Missing? </strong></h2>
<p>Many of the required components for the new worlds already exist: web servers, HTTP, server- and client-side scripting, 3D markup languages. Absolutely critical will be the presence of avatar-aware, 3D applications which render 3D content and provide motion for the avatars and interaction with the environment.</p>
<p>There are plenty of questions to answer on how best to represent avatars, how to communicate interactions with the server, how to redistribute data about fellow users, and more. How should the speciﬁcations support both a ballerina’s graceful movements and a more generic description of movement from Point A to Point B? How can these worlds provide new behaviors for avatars (trying on virtual clothes, learning a virtual dance, holding an object its hands)? Do avatars follow a user from site to site (this may be a chance for OpenID to shine)? How much can Asynchronous JavaScript and XML (AJAX) via the Transmission Control Protocol (TCP) sustain synchronizing avatars in the social 3D worlds?</p>
<p>These questions and more will someday be answered, but in the meantime, we are close to realizing a 3D web where anyone can publish content and where worlds eﬀortlessly hyperlink to other worlds. A ubiquitous, immersive, virtual 3D world is in fact nearly a reality.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.iharder.net/2009/01/20/initial-thoughts-3d-via-the-web/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

