[Midas] Using pydas to identify bitstream location

BRIAN E CHAPMAN Brian.Chapman at utah.edu
Thu Oct 31 17:41:03 EDT 2013


Thanks Zach,

I'm able to get things working with your tip.

Brian

Brian E. Chapman, Ph.D.
Associate Professor
Department of Radiology
University of Utah


From: Zach Mullen <zach.mullen at kitware.com<mailto:zach.mullen at kitware.com>>
Date: Thursday, October 31, 2013 8:29 AM
To: Brian Chapman <Brian.Chapman at utah.edu<mailto:Brian.Chapman at utah.edu>>
Cc: Jean-Christophe Fillion-Robin <jchris.fillionr at kitware.com<mailto:jchris.fillionr at kitware.com>>, "midas at public.kitware.com<mailto:midas at public.kitware.com>" <midas at public.kitware.com<mailto:midas at public.kitware.com>>
Subject: Re: [Midas] Using pydas to identify bitstream location

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.

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.

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).

HTH,

Zach


On Thu, Oct 31, 2013 at 1:43 AM, BRIAN E CHAPMAN <Brian.Chapman at utah.edu<mailto:Brian.Chapman at utah.edu>> wrote:
Zach and JC,

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).

Brian

________________________________
From: Jean-Christophe Fillion-Robin [jchris.fillionr at kitware.com<mailto:jchris.fillionr at kitware.com>]
Sent: Wednesday, October 30, 2013 5:54 PM
To: Zach Mullen
Cc: BRIAN E CHAPMAN; midas at public.kitware.com<mailto:midas at public.kitware.com>
Subject: Re: [Midas] Using pydas to identify bitstream location

Hi Zach,

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.

Jc


On Wed, Oct 30, 2013 at 7:43 PM, Zach Mullen <zach.mullen at kitware.com<mailto:zach.mullen at kitware.com>> wrote:
Hi Brian,

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?

Thanks,

Zach


On Wed, Oct 30, 2013 at 6:49 PM, BRIAN E CHAPMAN <Brian.Chapman at utah.edu<mailto:Brian.Chapman at utah.edu>> wrote:
Hello Midas World,

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?


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.
919 869 8848<tel:919%20869%208848>


Brian E. Chapman, Ph.D.
Associate Professor
Department of Radiology
University of Utah


_______________________________________________
Midas mailing list
Midas at public.kitware.com<mailto:Midas at public.kitware.com>
http://public.kitware.com/cgi-bin/mailman/listinfo/midas




--
Zach Mullen
R & D Engineer
Kitware Inc.
919-869-8858<tel:919-869-8858>

_______________________________________________
Midas mailing list
Midas at public.kitware.com<mailto:Midas at public.kitware.com>
http://public.kitware.com/cgi-bin/mailman/listinfo/midas




--
+1 919 869 8849<tel:%2B1%20919%20869%208849>



--
Zach Mullen
R & D Engineer
Kitware Inc.
919-869-8858
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/midas/attachments/20131031/29e11fc1/attachment-0001.html>


More information about the Midas mailing list