コード例 #1
0
ファイル: dvid_access.py プロジェクト: michael-kotliar/saber
def DVID_pull_cutout(args):
    rmt = DVIDRemote({"protocol": "http", "host": args.host})

    # Create or get a channel to write to
    instance_setup = DataInstanceResource(
        UUID=args.uuid,
        name=args.data_instance,
        type=args.type,
        alias=args.alias,
        datatype=args.datatype,
    )
    print("Data Instance setup.")

    x_rng = [args.xmin, args.xmax]
    y_rng = [args.ymin, args.ymax]
    z_rng = [args.zmin, args.zmax]
    # Verify that the cutout uploaded correctly.
    attempts = 0
    while attempts < 3:
        try:
            cutout_data = rmt.get_cutout(instance_setup, args.res, x_rng,
                                         y_rng, z_rng)
            break
        except HTTPError as e:
            if attempts < 3:
                attempts += 1
                print("Obtained HTTP error from server. Trial {}".format(
                    attempts))
            else:
                print("Failed 3 times: {}".format(e))
    # Data will be in Z,Y,X format
    # Change to X,Y,Z for pipeline
    cutout_data = np.transpose(cutout_data, (2, 1, 0))

    # Clean up.
    with open(args.output, "w+b") as f:
        np.save(f, cutout_data)
コード例 #2
0
import intern
from intern.remote.boss import BossRemote
from intern.resource.boss.resource import ChannelResource
from intern.remote.dvid import DVIDRemote
import matplotlib.pyplot as plt
import numpy as np

#DVID Data fetch:
dvid = DVIDRemote({
	"protocol": "http",
	"host": "localhost:8000",
	})
volumeD = dvid.get_cutout(
	dvid.get_channel("3ca15f84b1ee4fb780fef94c5771ffe6","dyer15_3_maskim"),0,
	[1287,1387],[1200,1300],[390,490]
	)

#Printing volumes:
print("Dvid volume: ")
print(volumeD)

#Graphing Dvid:
imgplot = plt.imshow(volumeD[3,:,:], cmap = "gray")
plt.show()
コード例 #3
0
ファイル: xBrainStart.py プロジェクト: aplbrain/repetir
from subprocess import call
import intern
from intern.remote.dvid import DVIDRemote

# #Starts Dockers
# call(["docker-compose", "up"])

#DVID Data fetch:
dvid = DVIDRemote({
    "protocol": "http",
    "host": "localhost:8000",
})

#Creating Project, and chanel to store boxed data in
proj = dvid.create_project('Xbrain_Proj1', 'Data upload test')
chan_setup = dvid.ChannelResource(proj, "MaskedImg1")

#Uploads Data
call([
    "docker-compose", "exec", "dvid", "dvid", "node", proj, "MaskedImg1",
    "load", "0" + "," + "0" + "," + "390", "dataLoad/*.tif"
])
print("The dvid instance has your requested data sample.")
コード例 #4
0
ファイル: Boss_Dvid_Download.py プロジェクト: dxenes1/intern
boss = BossRemote({
    "protocol": "https",
    "host": "api.theboss.io",
    "token": "db1cec2c865fc84e48772f4f4a5f010c0a180b88",
})
volumeB = boss.get_cutout(
    boss.get_channel("em", "pinky40", "v7"),
    1,
    [10000, 10500],
    [10000, 10500],
    [500, 550],
)

#DVID Data fetch:
dvid = DVIDRemote({
    "protocol": "http",
    "host": "localhost:8000",
})
volumeD = dvid.get_cutout(
    dvid.get_channel("5cc94d532799484cb01788fcdb7cd9f0", "grayscale"), 0,
    [2300, 4600], [2300, 4600], [1380, 1390])

#Printing volumes:
print("Dvid volume: ")
print(volumeD)
print("Boss volume: ")
print(volumeB)

#Graphing Boss:
imgplot = plt.imshow(volumeB[0, :, :], cmap="gray")
one = volumeB[0, :, :]
one_size = one.size
コード例 #5
0
import intern
from intern.remote.boss import BossRemote
from intern.resource.boss.resource import ChannelResource
from intern.remote.dvid import DVIDRemote
import matplotlib.pyplot as plt
import numpy as np

#DVID Data fetch:
dvid = DVIDRemote({
    "protocol": "http",
    "host": "localhost:8000",
})
chan_setup = dvid.ChannelResource('Xbrain_Proj_Dummy', 'dyer15_3_maskim_DUmmy',
                                  'masked_images', 'Data upload test', '')
proj = dvid.create_project(chan_setup)
print(proj)
# dvid.delete_project("8ef")
コード例 #6
0
from intern.remote.boss import BossRemote
from intern.remote.dvid import DVIDRemote
from intern.resource.boss.resource import *
import matplotlib.pyplot as plt
import numpy as np


# Define the BOSS remote
rmt = BossRemote({"protocol": "https", "host": "api.bossdb.io", "token": "public"})

ANN_COLL_NAME = "allan_johnson"
ANN_EXP_NAME = "gaj_17_40"

experiment = rmt.get_experiment(ANN_COLL_NAME, ANN_EXP_NAME)
print("Boss experiment extents: {}".format(rmt.get_extents(experiment)))


# Define the DVID remote
dvid = DVIDRemote({"protocol": "https", "host": "emdata.janelia.org",})
uuid = "822524777d3048b8bd520043f90c1d28"
name = "grayscale"
annos_name = "groundtruth"

print(
    "DVID data instance extents: {}".format(
        dvid.get_extents(dvid.get_instance(uuid, name, datatype="uint8"))
    )
)

コード例 #7
0
    def setUp(self):
        config = {"protocol": "https", "host": "emdata.janelia.org"}

        self.remote = DVIDRemote(config)
コード例 #8
0
boss = BossRemote({
    "protocol": "https",
    "host": "api.theboss.io",
    "token": "token",
})
volumeB = boss.get_cutout(
    boss.get_channel("em", "pinky40", "v7"),
    2,
    [10000, 10200],
    [10000, 10200],
    [501, 502],
)

#UPLOAD TO DVID REPOSITORY
dvid = DVIDRemote({
    "protocol": "http",
    "host": "localhost:8000",
})

chan_setup = dvid.ChannelResource('pinky40', 'BossData RemoteTest',
                                  'Data uploaded from Boss to dvid')
proj = dvid.create_project(chan_setup)
UUID = chan_setup.split("/")
UUID = UUID[0]

xrang = [0, 32]
yrang = [0, 32]
zrang = [32, 64]

volume = dvid.create_cutout(proj, xrang, yrang, zrang, volumeB)

#Check DVID Data:
コード例 #9
0
import intern
from intern.remote.dvid import DVIDRemote

#DVID Data fetch:
dvid = DVIDRemote({
    "protocol": "http",
    "host": "localhost:8000",
})

#Creating Project, and chanel to store boxed data in
proj = dvid.create_project('Xbrain_Proj1', 'Data upload test')
print("This is your UUID:" + proj)
chan_setup = dvid.ChannelResource(proj, "MaskedImg1")

#Uploading data
dataU = dvid.create_cutout(chan_setup, "xbrain_port9", 0, 0, 390, "/*.tif")
コード例 #10
0
from PIL import Image
import numpy as np
import os
import matplotlib.pyplot as plt

print "hello"

iNumS = 390  #Image Number start
iNumE = 405  #Image Number end
start = 0
end = 32

#Declare DVIDRemote
dvid = DVIDRemote({
    "protocol": "http",
    "host": "localhost:8000",
})

chan_setup = dvid.ChannelResource(
    'Proj4', 'dyer15_3_maskim', 'maked_images',
    'Data uploaded from XBrain experiments through intern')
proj = dvid.create_project(chan_setup)
# UUID = chan_setup.split("/")
# UUID = UUID[0]

while iNumS <= iNumE:
    directory = '/Users/rodrilm2/Documents/APL/GeorgiaTech/data/proj4_masked_390_2014/'
    # data = np.zeros((2560,2560))
    num = format(iNumS, "04")
    filename = "dyer15_3_maskimg_" + num + ".tif"
    pathname = os.path.join(directory, filename)
コード例 #11
0
ファイル: dvid_upload.py プロジェクト: jhuapl-boss/intern
from intern.remote.dvid import DVIDRemote
from intern.resource.dvid import DataInstanceResource
import numpy as np

dvid = DVIDRemote({"protocol": "http", "host": "localhost:8001",})

# Prepare the data
data_cube = np.load("/My/dummy/dir/validation_grayscale.npy").astype(np.uint8)
data_cube = data_cube[0:512, 0:512, 0:512]
data_cube = data_cube.copy(order="C")
print(data_cube.dtype)
print(data_cube.shape)
# Create the project
instance_setup_up = DataInstanceResource(
    alias="local_dvid_test",
    type="uint8blk",
    name="validation",
    UUID=None,
    datatype="uint8",
)
chan_actual_up = dvid.create_project(instance_setup_up)
# Create the cutout
dvid.create_cutout(instance_setup_up, 0, [0, 512], [0, 512], [0, 512], data_cube)
print("Create cutout successful")
# Get the cutout
got_cutout = dvid.get_cutout(instance_setup_up, 0, [0, 512], [0, 512], [0, 1])
print(got_cutout.shape)

print("Arrays match: {}".format(np.array_equal(got_cutout, data_cube[0:1, :, :])))

コード例 #12
0
ファイル: Dvid_X_Down.py プロジェクト: aplmicrons/intern
import intern
from intern.remote.dvid import DVIDRemote

from PIL import Image
import numpy as np
import os
import matplotlib.pyplot as plt

UUID = "30eb"

#Declare DVIDRemote
dvid = DVIDRemote({
    "protocol": "http",
    "host": "localhost:8000",
})

volumeD = dvid.get_cutout(
    dvid.get_channel(UUID, "dyer15_3_maskim_DUmmy", "dyer15_3_maskim_DUmmy"),
    0, [0, 2560], [0, 2560], [290, 292])
print(volumeD)
imgplot = plt.imshow(volumeD[0, :, :], cmap='gray')
plt.show()
コード例 #13
0
#Before running this program you should make sure to have the correct version of intern installed on your device.
from intern.remote.dvid import DVIDRemote
import intern
import os
import platform
from PIL import Image
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy
import requests
import time

#DVID Data fetch:
dvid = DVIDRemote({
    "protocol": "http",
    "host": "localhost:8000",
})

UUID = "5cc94d532799484cb01788fcdb7cd9f0"

#Getting information on the UUID
info = dvid.get_info(UUID)
print(info)

# Demonstration of obtaining and updating the log
log = dvid.get_log(UUID)
print(log)
logP = dvid.post_log(UUID, "This repository contains images used for testing2")
log = dvid.get_log(UUID)
print(log)
コード例 #14
0
ファイル: (1)dvid_localRepo.py プロジェクト: dxenes1/intern
import intern
from intern.remote.dvid import DVIDRemote

#DVID Data fetch:
dvid = DVIDRemote({
    "protocol": "http",
    "host": "localhost:8000",
})

#This path leads to where your data is stored.
path = "/Users/rod/to/where/your/data/is"

#Creating Local Dvid Repository
#Specification include: name of container, container port,
#and port number along with path
repo = dvid.StartLocalDvid("xbrain_dvid11", "xbrain_port11", "8000", path)
コード例 #15
0
ファイル: general_test.py プロジェクト: jhuapl-boss/intern
import intern
from intern.remote.dvid import DVIDRemote
from intern.resource.dvid.resource import DataInstanceResource
from intern.resource.dvid.resource import RepositoryResource
import numpy as np
from PIL import Image

########### NOTE ###########
# This test requires an accessible DVID instance

# DVID Data fetch:
dvid = DVIDRemote({
    "protocol": "http",
    "host": "localhost:8001",
})

DATA_INSTANCE = "ex_EM"
ALIAS = "Test_alias"

########### Test Project API ###########
## Create DataInstanceResource and force the creation of a RepositoryResource
instance_setup_em = DataInstanceResource(DATA_INSTANCE,
                                         None,
                                         "uint8blk",
                                         ALIAS,
                                         "Example channel.",
                                         datatype="uint8")

# Get the channel and create a project
instance_actual_repo = dvid.create_project(instance_setup_em)
print("Repo UUID:" + instance_actual_repo)
コード例 #16
0
ファイル: (3)dvid_Download.py プロジェクト: dxenes1/intern
import intern
from intern.remote.dvid import DVIDRemote
import matplotlib.pyplot as plt

#DVID Data fetch:
dvid = DVIDRemote({
    "protocol": "http",
    "host": "localhost:8000",
})

chan = "UUID/ChannelName"
volumeD = dvid.get_cutout(dvid.get_channel(chan), 0, [0, 2560], [0, 2560],
                          [390, 392])
print(volumeD)

imgplot = plt.imshow(volumeD[0, :, :], cmap="gray")
plt.show()
コード例 #17
0
ファイル: dvid_access.py プロジェクト: michael-kotliar/saber
def DVID_push_cutout(args):
    rmt = DVIDRemote({"protocol": "http", "host": args.host})

    # data is desired range

    data = np.load(args.input)

    numpyType = np.uint8
    if args.datatype == "uint32":
        numpyType = np.uint32
    elif args.datatype == "uint64":
        numpyType = np.uint64

    if data.dtype != args.datatype:
        data = data.astype(numpyType)
    sources = []
    if args.source:
        sources.append(args.source)

    # Create or get a channel to write to
    instance_setup = DataInstanceResource(
        UUID=args.uuid,
        name=args.data_instance,
        type=args.type,
        alias=args.alias,
        datatype=args.datatype,
    )
    print("Data Instance setup.")
    chan_actual_up = rmt.create_project(instance_setup)
    x_rng = [args.xmin, args.xmax]
    y_rng = [args.ymin, args.ymax]
    z_rng = [args.zmin, args.zmax]

    print("Data model setup. UUID: {}".format(chan_actual_up))

    # Pipeline Data will be in X,Y,Z format
    # Change to Z,Y,X for upload
    data = np.transpose(data, (2, 1, 0))
    data = data.copy(order="C")
    # Verify that the cutout uploaded correctly.
    attempts = 0
    while attempts < 3:
        try:
            rmt.create_cutout(instance_setup, args.res, x_rng, y_rng, z_rng,
                              data)
            break
        except HTTPError as e:
            if attempts < 3:
                attempts += 1
                print("These are the dimensions: ")
                print(data.shape)
                print("This is the data type:")
                print(data.dtype)
                print("Specified data type was:")
                print(args.dtype)
                print("Specified image type")
                print(args.itype)
                print("Obtained HTTP error from server. Trial {}".format(
                    attempts))
                print("The error: {}".format(e))
            else:
                raise Exception("Failed 3 times: {}".format(e))
コード例 #18
0
from intern.remote.dvid import DVIDRemote
import matplotlib.pyplot as plt
import numpy as np

# DVID Data fetch:

# Define the remote
dvid = DVIDRemote({
    "protocol": "https",
    "host": "emdata.janelia.org",
})
uuid = "822524777d3048b8bd520043f90c1d28"
name = "grayscale"
annos_name = "groundtruth"

print(dvid.get_extents(dvid.get_instance(uuid, name, datatype="uint8")))

# get cutout from actual dataset
volumeD = dvid.get_cutout(
    dvid.get_instance(uuid, name, datatype="uint8"),
    0,
    [3000, 3150],
    [3000, 3150],
    [2000, 2010],
)

# get annotations from dataset
annosD = dvid.get_cutout(
    dvid.get_instance(uuid, annos_name, datatype="uint64"),
    0,
    [3000, 3150],