Skip to content

Instantly share code, notes, and snippets.

@Ghazi-Bouabene
Created November 26, 2015 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ghazi-Bouabene/26b4f18d9a8355d388af to your computer and use it in GitHub Desktop.
Save Ghazi-Bouabene/26b4f18d9a8355d388af to your computer and use it in GitHub Desktop.
Retrieve status of ETH automatic segmentation of femur on VSD
package vsdClientSeed
import java.io.File
import ch.unibas.cs.gravis.vsdclient.{VSDCommonObjectInfo, VSDClient}
import ch.unibas.cs.gravis.vsdclient.VSDJson._
import scala.concurrent.Future
object VSDLegStatus {
def main(args: Array[String]): Unit = {
implicit val ctxt = scala.concurrent.ExecutionContext.global
val vsd = VSDClient(new File("/home/bouabene/vsdcreds.txt")).get
val segmentationInfos = for {
segFolder <- vsd.getFolderFromPath("/bouag1/SharedFolders/SSMPipeline/Lower_Extremities/02_AutomaticSegmentation")
objList = segFolder.get.containedObjects.get
segmentationAnatomicalSides <- Future.sequence(objList.map { url => vsd.getAnatomicalSide(url) })
segmentationsInfos <- Future.sequence(objList.map { url => vsd.getVSDObjectInfo[VSDCommonObjectInfo](url) })
linkedRawObject = segmentationsInfos.map(_.linkedObjects.get.items.head)
rawInfos <- Future.sequence(linkedRawObject.map { url => vsd.getVSDObjectInfo[VSDCommonObjectInfo](url) })
} yield (objList, segmentationAnatomicalSides.map(_.get), rawInfos).zipped.toList
segmentationInfos.onSuccess { case list =>
println("[Description of associated Raw image], [Anatomical side of segmentation], [Name of associated Raw Image], [URL of segmentation]")
list.foreach{ case (segURL, side, rawInfo) =>
println( rawInfo.description.get +", " + side + ", " + rawInfo.name + ", " + segURL.selfUrl )
}
vsd.shutdown()
}
segmentationInfos.onFailure { case e => println("failed : " + e.getMessage); vsd.shutdown() }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment