<div dir="ltr">Interesting. If you know the root path of the assetstore, you can derive the full path based on the bitstream's md5sum, which is exposed in the API.<div><br></div><div>Bitstreams are always stored in a two-level nested directory structure under the assetstore root path, and those two directories are just prefixes of the md5sum. For example, if my assetstore is at /Users/zach/dev/midas/data/assetstore/ and my bitstream has md5sum=66c1d0d9132ec15ae8f238e4767753a8, then the path of the bitstream on disk is /Users/zach/dev/midas/data/assetstore/66/c1/66c1d0d9132ec15ae8f238e4767753a8.</div>

<div><br></div><div>This is sufficient if you hard-code the assetstore path, but a more general solution would involve creating a new API endpoint to expose assetstores (such an endpoint doesn't exist yet).</div><div>

<br></div><div>HTH,</div><div><br></div><div>Zach</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Oct 31, 2013 at 1:43 AM, BRIAN E CHAPMAN <span dir="ltr"><<a href="mailto:Brian.Chapman@utah.edu" target="_blank">Brian.Chapman@utah.edu</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">Zach and JC,
<div><br>
</div>
<div>What I'm envisioning is something similar to what JC describes. I'm playing around with using an IPython notebook as a web-based means of data exploration via SimpleITK, OpenCV, etc. So I was hoping to be able to figure out from pydas where the file was
 located on the disk and pass that to the reader (e.g., SimpleITK image reader).</div>
<div><br>
</div>
<div>Brian<br>
<div style="font-family:'Times New Roman';font-size:16px"></div>
</div>
<br>
<hr>
<div><font face="Tahoma" color="#000000"><b>From:</b> Jean-Christophe Fillion-Robin [<a href="mailto:jchris.fillionr@kitware.com" target="_blank">jchris.fillionr@kitware.com</a>]<br>
<b>Sent:</b> Wednesday, October 30, 2013 5:54 PM<br>
<b>To:</b> Zach Mullen<br>
<b>Cc:</b> BRIAN E CHAPMAN; <a href="mailto:midas@public.kitware.com" target="_blank">midas@public.kitware.com</a><br>
<b>Subject:</b> Re: [Midas] Using pydas to identify bitstream location<br>
</font><br>
</div><div><div class="h5">
<div></div>
<div>
<div dir="ltr">
<div>
<div>Hi Zach, <br>
<br>
</div>
I guess for performance purpose, if one would like to have a common file-system between a processing/visualization server and midas server. Knowing the location of the bitstream would avoid unneeded streaming operation.
</div>
<div><br>
</div>
Jc<br>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Wed, Oct 30, 2013 at 7:43 PM, Zach Mullen <span dir="ltr">
<<a href="mailto:zach.mullen@kitware.com" target="_blank">zach.mullen@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi Brian,
<div><br>
</div>
<div>The location of a bitstream on the server's filesystem is known only to the server, it isn't exposed in the API in any way. As such, it wouldn't be possible to know its server-side path using pydas. Out of curiosity, what's your use case where you would
 want to know that information?</div>
<div><br>
</div>
<div>Thanks,</div>
<div><br>
</div>
<div>Zach</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">
<div>
<div>On Wed, Oct 30, 2013 at 6:49 PM, BRIAN E CHAPMAN <span dir="ltr"><<a href="mailto:Brian.Chapman@utah.edu" target="_blank">Brian.Chapman@utah.edu</a>></span> wrote:<br>
</div>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div>
<div style="font-size:14px;font-family:Calibri,sans-serif;word-wrap:break-word">
<div>
<div>
<div>Hello Midas World,</div>
<div><br>
</div>
<div>In 2012 Patrick posted the following code snippet to identify the location of a bitstream in the file system. Can the equivalent be done in pydas?</div>
<div><br>
</div>
<div>
<pre>Mona,

First, a bit about how items correspond to files. Items are made up of revisions. Most items contain one revision (the head or latest revision). Within each revision are bitstreams. These bitstreams are analogous to the files on the file system. With all that in mind, the following code should get you what you want (I'm going to assume the item ID is in a variable called, appropriately, $itemId.):

// Load our models
$ItemModel = MidasLoader::loadModel('Item');
$ItemRevisionModel = MidasLoader::loadModel('ItemRevision');
$BitstreamModel = MidasLoader::loadModel('Bitstream');

// Get the item and its last revision from the time id
$itemDao = $ItemModel->load($itemId);
$lastRevisionDao = $ItemModel->getLastRevision($itemDao);

// loop through the bitstreams and print their paths
foreach($lastRevisionDao->getBitstreams() as $bitstreamDao)
  {
  print($bitstreamDao->getPath());
  }

Hope that helps! 

Thanks,
Patrick Reynolds
Technical Leader
Kitware, Inc.
<a href="tel:919%20869%208848" value="+19198698848" target="_blank">919 869 8848</a></pre>
<pre><br></pre>
</div>
<div>
<div>Brian E. Chapman, Ph.D.</div>
<div>Associate Professor</div>
<div>Department of Radiology</div>
<div>University of Utah</div>
<div><br>
</div>
</div>
</div>
</div>
</div>
<br>
</div>
</div>
_______________________________________________<br>
Midas mailing list<br>
<a href="mailto:Midas@public.kitware.com" target="_blank">Midas@public.kitware.com</a><br>
<a href="http://public.kitware.com/cgi-bin/mailman/listinfo/midas" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/midas</a><br>
<br>
</blockquote>
</div>
<span><font color="#888888"><br>
<br clear="all">
<div><br>
</div>
-- <br>
Zach Mullen<br>
R & D Engineer<br>
Kitware Inc.<br>
<a href="tel:919-869-8858" value="+19198698858" target="_blank">919-869-8858</a> </font>
</span></div>
<br>
_______________________________________________<br>
Midas mailing list<br>
<a href="mailto:Midas@public.kitware.com" target="_blank">Midas@public.kitware.com</a><br>
<a href="http://public.kitware.com/cgi-bin/mailman/listinfo/midas" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/midas</a><br>
<br>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
<a href="tel:%2B1%20919%20869%208849" value="+19198698849" target="_blank">+1 919 869 8849</a><br>
</div>
</div>
</div>
</div></div></div>
</div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br>Zach Mullen<br>R & D Engineer<br>Kitware Inc.<br>919-869-8858
</div>