Skip to content

Commit

Permalink
Adapt DFCAN to new TF version
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanHCenalmor committed Nov 9, 2023
1 parent d85e0a3 commit 9069b5a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Colab_notebooks/DFCAN_ZeroCostDL4Mic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@
"\n",
"\n",
"def fftshift2d(input, size_psc):\n",
" bs, h, w, ch = input.get_shape().as_list()\n",
" h = tf.shape(input)[1]\n",
" w = tf.shape(input)[2]\n",
" fs11 = input[:, -h // 2:h, -w // 2:w, :]\n",
" fs12 = input[:, -h // 2:h, 0:w // 2, :]\n",
" fs21 = input[:, 0:h // 2, -w // 2:w, :]\n",
Expand All @@ -357,7 +358,9 @@
"\n",
"\n",
"def fftshift3d(input, size_psc=64):\n",
" bs, h, w, z, ch = input.get_shape().as_list()\n",
" h = tf.shape(input)[1]\n",
" w = tf.shape(input)[2]\n",
" z = tf.shape(input)[3]\n",
" fs111 = input[:, -h // 2:h, -w // 2:w, -z // 2 + 1:z, :]\n",
" fs121 = input[:, -h // 2:h, 0:w // 2, -z // 2 + 1:z, :]\n",
" fs211 = input[:, 0:h // 2, -w // 2:w, -z // 2 + 1:z, :]\n",
Expand All @@ -377,7 +380,9 @@
"\n",
"\n",
"def apodize2d(img, napodize=10):\n",
" bs, ny, nx, ch = img.get_shape().as_list()\n",
" ny = tf.shape(input)[1]\n",
" nx = tf.shape(input)[2]\n",
" ch = tf.shape(input)[3]\n",
" img_apo = img[:, napodize:ny-napodize, :, :]\n",
"\n",
" imageUp = img[:, 0:napodize, :, :]\n",
Expand Down Expand Up @@ -409,7 +414,10 @@
"\n",
"\n",
"def apodize3d(img, napodize=5):\n",
" bs, ny, nx, nz, ch = img.get_shape().as_list()\n",
" ny = tf.shape(input)[1]\n",
" nx = tf.shape(input)[2]\n",
" nz = tf.shape(input)[3]\n",
" ch = tf.shape(input)[4]\n",
" img_apo = img[:, napodize:ny-napodize, :, :, :]\n",
"\n",
" imageUp = img[:, 0:napodize, :, :, :]\n",
Expand Down

0 comments on commit 9069b5a

Please sign in to comment.