[Midas] Using pydas to identify bitstream location

Jean-Christophe Fillion-Robin jchris.fillionr at kitware.com
Wed Oct 30 19:54:43 EDT 2013


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>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>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
>>
>>
>>  Brian E. Chapman, Ph.D.
>> Associate Professor
>> Department of Radiology
>> University of Utah
>>
>>
>> _______________________________________________
>> Midas mailing list
>> Midas at public.kitware.com
>> http://public.kitware.com/cgi-bin/mailman/listinfo/midas
>>
>>
>
>
> --
> Zach Mullen
> R & D Engineer
> Kitware Inc.
> 919-869-8858
>
> _______________________________________________
> Midas mailing list
> Midas at public.kitware.com
> http://public.kitware.com/cgi-bin/mailman/listinfo/midas
>
>


-- 
+1 919 869 8849
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/midas/attachments/20131030/7d3faed6/attachment.html>


More information about the Midas mailing list