Merge branch 'master' of https://gitlab.psi.ch/fische_r/pytrainseg
This commit is contained in:
File diff suppressed because one or more lines are too long
+109
-38
@@ -60,7 +60,10 @@
|
||||
" G = np.array(da)\n",
|
||||
" fullname = 'original'\n",
|
||||
" else:\n",
|
||||
" G = da.map_overlap(filters.gaussian, depth=4*sig+1, sigma = sig).compute()\n",
|
||||
" deptharray = np.ones(da.ndim)+4*sig\n",
|
||||
" deptharray = tuple(np.min([deptharray, da.shape], axis=0))\n",
|
||||
" G = da.map_overlap(filters.gaussian, depth=deptharray, boundary='nearest', sigma = sig).compute()\n",
|
||||
" # G = da.map_overlap(filters.gaussian, depth=4*sig+1, boundary='none', sigma = sig).compute()\n",
|
||||
" fullname = ''.join(['gaussian_',f'{sig:.1f}'])\n",
|
||||
" return G, fullname\n",
|
||||
"\n",
|
||||
@@ -99,7 +102,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 15,
|
||||
"id": "02de82f3-ba96-4b85-a85a-b81a7f413a15",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -133,7 +136,10 @@
|
||||
" fun = ndimage.median_filter\n",
|
||||
" else:\n",
|
||||
" print(option+' not available')\n",
|
||||
" M = da.map_overlap(fun, depth=sigma+1, footprint=fp).compute()\n",
|
||||
" deptharray = np.ones(da.ndim)+sigma\n",
|
||||
" deptharray = tuple(np.min([deptharray, da.shape], axis=0))\n",
|
||||
" M = da.map_overlap(fun, depth=deptharray, footprint=fp).compute()\n",
|
||||
" # M = da.map_overlap(fun, depth=sigma+1, footprint=fp).compute()\n",
|
||||
" fullname = ''.join([option,'_',f'{sigma:.1f}'])\n",
|
||||
" return M, fullname\n",
|
||||
"\n",
|
||||
@@ -149,28 +155,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 370,
|
||||
"id": "c6614dc5-ae4c-4fc9-af61-16a82bd2df0a",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"gradients = dask.array.gradient(da)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 373,
|
||||
"id": "e951ab31-b487-4889-a65a-4173dc4b0667",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"axes = range(da.ndim)\n",
|
||||
"test = [gradients[ax0].compute() for ax0 in axes]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 379,
|
||||
"execution_count": 5,
|
||||
"id": "401c4f79-98a5-435a-a255-22bae402418d",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -232,7 +217,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 32,
|
||||
"execution_count": 6,
|
||||
"id": "65898c62-240b-47ed-a137-5b93f7adb84f",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -460,7 +445,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": 7,
|
||||
"id": "35aaa579-91e7-43d2-a621-120d1ca6c971",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -471,7 +456,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"execution_count": 8,
|
||||
"id": "eaf95f61-52a7-4b9a-b31d-a1fb2e6be76e",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -481,7 +466,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"execution_count": 9,
|
||||
"id": "7fa528a4-10a6-410a-9ac1-3415524fc60a",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -590,7 +575,7 @@
|
||||
"dask.array<array, shape=(200, 39, 233, 8), dtype=float64, chunksize=(200, 39, 233, 8), chunktype=numpy.ndarray>"
|
||||
]
|
||||
},
|
||||
"execution_count": 21,
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@@ -609,12 +594,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 366,
|
||||
"execution_count": 10,
|
||||
"id": "f8ccaf6d-8921-4e94-ab6c-f0ff46432443",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sigmas = [0, 1]#,4, 8] #hard-coded for now, sobel and hessian require that first sigma is 0, diff, gaussian(sig=0) = 0\n",
|
||||
"sigmas = [0, 1,4, 8] #hard-coded for now, sobel and hessian require that first sigma is 0, diff, gaussian(sig=0) = 0\n",
|
||||
"\n",
|
||||
"# default feature choice\n",
|
||||
"feat_select = {'Gaussian': True, \n",
|
||||
@@ -629,7 +614,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 367,
|
||||
"execution_count": 11,
|
||||
"id": "2a00402e-a7bc-4eae-ad31-04950094df86",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -647,7 +632,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 104,
|
||||
"execution_count": 12,
|
||||
"id": "cdb1c7b8-85bb-4707-b9ae-15716a621558",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -658,17 +643,29 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 107,
|
||||
"execution_count": 13,
|
||||
"id": "ac1b5a84-f5b7-4174-b227-f6f1068382e8",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "NameError",
|
||||
"evalue": "name 'feat_data' is not defined",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
||||
"Input \u001b[0;32mIn [13]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mfeat_data\u001b[49m\u001b[38;5;241m.\u001b[39mclose()\n",
|
||||
"\u001b[0;31mNameError\u001b[0m: name 'feat_data' is not defined"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"feat_data.close()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 380,
|
||||
"execution_count": 16,
|
||||
"id": "39d1f364-d2c8-4fba-accf-931372c90622",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -1236,10 +1233,84 @@
|
||||
"training_dict = {}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 25,
|
||||
"id": "9fb15524-6770-4423-8169-30c4f3908c9f",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"4"
|
||||
]
|
||||
},
|
||||
"execution_count": 25,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"da.ndim"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 26,
|
||||
"id": "e730fe76-7541-4e0a-bbf4-4f261e33d386",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"(200, 39, 233, 8)"
|
||||
]
|
||||
},
|
||||
"execution_count": 26,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"da.shape"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 28,
|
||||
"id": "c8133d05-a8ab-4fe1-824d-b232fb6cb47b",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"deptharray = np.ones(da.ndim)+4\n",
|
||||
"deptharray = np.max([deptharray, da.shape], axis=0)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 31,
|
||||
"id": "455ab1b9-00c3-4393-bab6-61736fb40a9c",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"(200.0, 39.0, 233.0, 8.0)"
|
||||
]
|
||||
},
|
||||
"execution_count": 31,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"tuple(deptharray)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "f6d4b425-20d3-49da-8ab1-8502947f914a",
|
||||
"id": "6093818a-005e-49a6-af56-06d1b323ff54",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
|
||||
Reference in New Issue
Block a user