Пример #1
0
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
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()
Пример #4
0
})
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
plt.show()

#Graphing Dvid:
Пример #5
0
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, :, :])))

Пример #6
0
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()
Пример #7
0
#

# Prepare the data
img = Image.open("<somedir>/*.png")
data_tile = np.asarray(img)
print(data_tile.shape)
data_tile = np.expand_dims(data_tile, axis=0)
data_tile = data_tile.copy(order="C")

# Create the project
instance_setup_up = DataInstanceResource(
    DATA_INSTANCE + "_the_second",
    None,
    "imagetile",
    "Upload Test",
    "Example channel.",
    datatype="uint8",
)
chan_actual_up = dvid.create_project(instance_setup_up)

# Create the cutout
dvid.create_cutout(instance_setup_up, 0, [0, 454], [0, 480], [0, 1], data_tile)
print("Create cutout successful")

# Get the cutout
got_cutout = dvid.get_cutout(instance_setup_up, 0, [0, 454], [0, 480], [0, 1])

# Check for equality
if (got_cutout == data_tile).all():
    print("Both tiles equate")
Пример #8
0
    [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:
volumeD = dvid.get_cutout(dvid.get_channel(UUID, "pinky40", "Medulla"), 0,
                          [0, 200], [0, 200], [32, 33])
print(volumeD)

imgplot = plt.imshow(volumeD[:, :, 0], cmap="gray")
plt.show()
Пример #9
0
# 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],
    [3000, 3150],
    [2000, 2010],
)

# overlay the data
plt.imshow(volumeD[0, :, :], cmap="gray")