diff --git a/demos/module_examples/FullCSVReaderDemo.ipynb b/demos/module_examples/FullCSVReaderDemo.ipynb index fb33cc00..0b2bc739 100644 --- a/demos/module_examples/FullCSVReaderDemo.ipynb +++ b/demos/module_examples/FullCSVReaderDemo.ipynb @@ -2,22 +2,9 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 14, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "INFO:tensorflow:TensorFlow version 1.10.0\n", - "CRITICAL:tensorflow:Optional Python module SimpleITK not found, please install SimpleITK and retry if the application fails.\n", - "INFO:tensorflow:Available Image Loaders:\n", - "['nibabel', 'opencv', 'skimage', 'pillow', 'dummy'].\n", - "\u001b[1mINFO:niftynet:\u001b[0m Optional Python module SimpleITK not found, please install SimpleITK and retry if the application fails.\n", - "\u001b[1mINFO:niftynet:\u001b[0m Optional Python module SimpleITK version None not found, please install SimpleITK-None and retry if the application fails.\n" - ] - } - ], + "outputs": [], "source": [ "import sys\n", "import os\n", @@ -40,7 +27,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 15, "metadata": {}, "outputs": [], "source": [ @@ -63,7 +50,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 16, "metadata": {}, "outputs": [ { @@ -199,7 +186,7 @@ "14 CRI CRI" ] }, - "execution_count": 3, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -215,7 +202,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -276,7 +263,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 18, "metadata": {}, "outputs": [ { @@ -326,212 +313,212 @@ " \n", " 0\n", " RAN\n", - " 0.321972\n", - " 0.652648\n", - " 0.113185\n", - " -0.722681\n", - " -0.593930\n", - " -0.900718\n", - " -0.808985\n", - " -0.368086\n", - " -1.262447\n", - " -2.299978\n", + " -2.018905\n", + " 0.016700\n", + " 0.753500\n", + " 0.225668\n", + " -0.453137\n", + " 0.007740\n", + " 0.405050\n", + " -0.038025\n", + " -1.144459\n", + " -0.437604\n", " \n", " \n", " 1\n", " HAL\n", - " -0.439402\n", - " 0.675593\n", - " -0.657466\n", - " 0.768496\n", - " -0.382948\n", - " 0.474596\n", - " -0.276786\n", - " -0.392421\n", - " -0.119055\n", - " 1.252547\n", + " 0.750608\n", + " 1.339236\n", + " 0.393103\n", + " 0.403952\n", + " 0.034992\n", + " 1.743924\n", + " 0.222566\n", + " 0.411477\n", + " -0.557221\n", + " 0.407324\n", " \n", " \n", " 2\n", " MIL\n", - " 1.085595\n", - " 0.076346\n", - " 0.345417\n", - " -0.196474\n", - " 0.716523\n", - " -0.548726\n", - " 0.408472\n", - " 0.018024\n", - " -0.583368\n", - " -0.780949\n", + " -0.581589\n", + " -0.988355\n", + " -1.536794\n", + " 0.344513\n", + " -0.161370\n", + " -0.118697\n", + " -0.322209\n", + " 0.063637\n", + " -1.028091\n", + " -0.392706\n", " \n", " \n", " 3\n", " CHA\n", - " -2.210596\n", - " -0.137564\n", - " 0.323351\n", - " 0.891198\n", - " -0.778046\n", - " 0.031523\n", - " -0.463217\n", - " -0.685250\n", - " -0.172702\n", - " 0.011653\n", + " 2.234084\n", + " -0.264239\n", + " -0.923163\n", + " -0.817617\n", + " 0.388325\n", + " 0.560078\n", + " -0.477164\n", + " 1.966860\n", + " -0.018510\n", + " 0.442490\n", " \n", " \n", " 4\n", " GRA\n", - " 0.829021\n", - " -0.344907\n", - " -1.552366\n", - " -2.156463\n", - " -0.772904\n", - " -0.023208\n", - " 1.357851\n", - " 0.409369\n", - " 0.667640\n", - " -0.151443\n", + " 0.653114\n", + " 0.477493\n", + " 0.650812\n", + " 1.353049\n", + " 0.734319\n", + " -1.539332\n", + " 0.653350\n", + " -0.752011\n", + " -0.634769\n", + " -0.231503\n", " \n", " \n", " 5\n", " PLA\n", - " 0.410349\n", - " 1.233560\n", - " 0.108877\n", - " -0.946675\n", - " 0.379490\n", - " -0.195135\n", - " -0.299669\n", - " -0.072078\n", - " 0.060394\n", - " 0.123195\n", + " -0.983351\n", + " -1.600570\n", + " 0.223609\n", + " -1.100547\n", + " -0.430255\n", + " 1.315413\n", + " -0.702730\n", + " -1.838355\n", + " -0.810046\n", + " 2.419473\n", " \n", " \n", " 6\n", " NAR\n", - " 0.836927\n", - " 0.857035\n", - " 0.874829\n", - " 0.686557\n", - " -0.891095\n", - " -0.223142\n", - " 0.021994\n", - " 1.012295\n", - " 1.178720\n", - " -1.403227\n", + " 0.810422\n", + " -2.304446\n", + " -0.079281\n", + " 0.456476\n", + " 0.643375\n", + " 0.268823\n", + " 0.366755\n", + " 0.530736\n", + " 1.345358\n", + " 0.515989\n", " \n", " \n", " 7\n", " WEB\n", - " 1.330076\n", - " -1.140574\n", - " 2.268951\n", - " -1.947345\n", - " -0.734009\n", - " 0.002782\n", - " -0.182076\n", - " -0.303120\n", - " 1.700154\n", - " 0.836683\n", + " 0.710464\n", + " -0.665521\n", + " -1.130775\n", + " -0.437872\n", + " -0.359845\n", + " -0.128057\n", + " -0.472871\n", + " -0.060746\n", + " 1.754929\n", + " -1.009953\n", " \n", " \n", " 8\n", " PAR\n", - " -0.861265\n", - " 0.076940\n", - " 1.981806\n", - " -0.018995\n", - " -0.362837\n", - " -1.420218\n", - " 0.347479\n", - " -0.656022\n", - " 1.957113\n", - " -0.974995\n", + " 1.380408\n", + " -0.825570\n", + " -0.630116\n", + " -2.312509\n", + " -0.335770\n", + " -1.176994\n", + " -0.455428\n", + " -0.757432\n", + " -0.171152\n", + " 0.803127\n", " \n", " \n", " 9\n", " HON\n", - " -0.133184\n", - " -0.681829\n", - " 0.238010\n", - " 1.288651\n", - " -0.573452\n", - " 2.361199\n", - " -0.795531\n", - " -1.134068\n", - " -0.439827\n", - " -0.498937\n", + " -0.312656\n", + " -0.707139\n", + " 0.571808\n", + " 0.682854\n", + " 0.907817\n", + " 0.067288\n", + " -0.384104\n", + " -1.030702\n", + " 0.015677\n", + " -0.808565\n", " \n", " \n", " 10\n", " HAF\n", - " 0.684381\n", - " -1.145172\n", - " -0.115175\n", - " 0.446454\n", - " -0.649224\n", - " -0.882938\n", - " -0.983248\n", - " 0.571107\n", - " -0.390658\n", - " 0.067865\n", + " 2.413476\n", + " -0.258832\n", + " 0.351502\n", + " -1.447595\n", + " -0.861127\n", + " 1.074561\n", + " -0.550000\n", + " 1.082476\n", + " 0.487512\n", + " -0.926261\n", " \n", " \n", " 11\n", " LEW\n", - " 1.150170\n", - " -0.793785\n", - " 0.590165\n", - " -0.126870\n", - " -0.887013\n", - " 0.495526\n", - " -0.395386\n", - " 0.448884\n", - " -1.646706\n", - " 0.523825\n", + " 0.466895\n", + " -0.375061\n", + " 0.657998\n", + " 1.203485\n", + " 1.347131\n", + " 0.552526\n", + " -0.705073\n", + " 1.992426\n", + " -0.816416\n", + " 0.532992\n", " \n", " \n", " 12\n", " SOU\n", - " 0.792047\n", - " -1.516437\n", - " 1.087191\n", - " -3.077545\n", - " 0.286219\n", - " 0.756354\n", - " -0.795725\n", - " -1.012792\n", - " 0.194806\n", - " -0.874716\n", + " -0.009581\n", + " -0.436214\n", + " -0.600287\n", + " 2.147111\n", + " 0.839317\n", + " -0.444572\n", + " 0.197550\n", + " 0.548611\n", + " 0.334053\n", + " -1.498843\n", " \n", " \n", " 13\n", " SPE\n", - " -1.675722\n", - " -1.730294\n", - " 1.013535\n", - " 0.354879\n", - " -1.044123\n", - " 0.656389\n", - " 0.549337\n", - " -1.416101\n", - " -1.320003\n", - " -1.398806\n", + " 0.238420\n", + " -0.966039\n", + " -0.073183\n", + " 1.595601\n", + " -0.093269\n", + " -1.048532\n", + " -0.657099\n", + " -1.178905\n", + " 0.795620\n", + " -0.974147\n", " \n", " \n", " 14\n", " CRI\n", - " -1.193647\n", - " 1.017665\n", - " -1.156596\n", - " 0.947748\n", - " -2.377250\n", - " -0.177449\n", - " 0.893184\n", - " 1.063577\n", - " -0.580513\n", - " -0.128269\n", + " -0.188791\n", + " 1.611999\n", + " 0.423356\n", + " -1.644961\n", + " -0.961844\n", + " -1.446989\n", + " 0.869527\n", + " -1.843371\n", + " -2.446698\n", + " -1.428567\n", " \n", " \n", "\n", @@ -539,41 +526,41 @@ ], "text/plain": [ " subject_id 0 1 2 3 4 5 \\\n", - "0 RAN 0.321972 0.652648 0.113185 -0.722681 -0.593930 -0.900718 \n", - "1 HAL -0.439402 0.675593 -0.657466 0.768496 -0.382948 0.474596 \n", - "2 MIL 1.085595 0.076346 0.345417 -0.196474 0.716523 -0.548726 \n", - "3 CHA -2.210596 -0.137564 0.323351 0.891198 -0.778046 0.031523 \n", - "4 GRA 0.829021 -0.344907 -1.552366 -2.156463 -0.772904 -0.023208 \n", - "5 PLA 0.410349 1.233560 0.108877 -0.946675 0.379490 -0.195135 \n", - "6 NAR 0.836927 0.857035 0.874829 0.686557 -0.891095 -0.223142 \n", - "7 WEB 1.330076 -1.140574 2.268951 -1.947345 -0.734009 0.002782 \n", - "8 PAR -0.861265 0.076940 1.981806 -0.018995 -0.362837 -1.420218 \n", - "9 HON -0.133184 -0.681829 0.238010 1.288651 -0.573452 2.361199 \n", - "10 HAF 0.684381 -1.145172 -0.115175 0.446454 -0.649224 -0.882938 \n", - "11 LEW 1.150170 -0.793785 0.590165 -0.126870 -0.887013 0.495526 \n", - "12 SOU 0.792047 -1.516437 1.087191 -3.077545 0.286219 0.756354 \n", - "13 SPE -1.675722 -1.730294 1.013535 0.354879 -1.044123 0.656389 \n", - "14 CRI -1.193647 1.017665 -1.156596 0.947748 -2.377250 -0.177449 \n", + "0 RAN -2.018905 0.016700 0.753500 0.225668 -0.453137 0.007740 \n", + "1 HAL 0.750608 1.339236 0.393103 0.403952 0.034992 1.743924 \n", + "2 MIL -0.581589 -0.988355 -1.536794 0.344513 -0.161370 -0.118697 \n", + "3 CHA 2.234084 -0.264239 -0.923163 -0.817617 0.388325 0.560078 \n", + "4 GRA 0.653114 0.477493 0.650812 1.353049 0.734319 -1.539332 \n", + "5 PLA -0.983351 -1.600570 0.223609 -1.100547 -0.430255 1.315413 \n", + "6 NAR 0.810422 -2.304446 -0.079281 0.456476 0.643375 0.268823 \n", + "7 WEB 0.710464 -0.665521 -1.130775 -0.437872 -0.359845 -0.128057 \n", + "8 PAR 1.380408 -0.825570 -0.630116 -2.312509 -0.335770 -1.176994 \n", + "9 HON -0.312656 -0.707139 0.571808 0.682854 0.907817 0.067288 \n", + "10 HAF 2.413476 -0.258832 0.351502 -1.447595 -0.861127 1.074561 \n", + "11 LEW 0.466895 -0.375061 0.657998 1.203485 1.347131 0.552526 \n", + "12 SOU -0.009581 -0.436214 -0.600287 2.147111 0.839317 -0.444572 \n", + "13 SPE 0.238420 -0.966039 -0.073183 1.595601 -0.093269 -1.048532 \n", + "14 CRI -0.188791 1.611999 0.423356 -1.644961 -0.961844 -1.446989 \n", "\n", " 6 7 8 9 \n", - "0 -0.808985 -0.368086 -1.262447 -2.299978 \n", - "1 -0.276786 -0.392421 -0.119055 1.252547 \n", - "2 0.408472 0.018024 -0.583368 -0.780949 \n", - "3 -0.463217 -0.685250 -0.172702 0.011653 \n", - "4 1.357851 0.409369 0.667640 -0.151443 \n", - "5 -0.299669 -0.072078 0.060394 0.123195 \n", - "6 0.021994 1.012295 1.178720 -1.403227 \n", - "7 -0.182076 -0.303120 1.700154 0.836683 \n", - "8 0.347479 -0.656022 1.957113 -0.974995 \n", - "9 -0.795531 -1.134068 -0.439827 -0.498937 \n", - "10 -0.983248 0.571107 -0.390658 0.067865 \n", - "11 -0.395386 0.448884 -1.646706 0.523825 \n", - "12 -0.795725 -1.012792 0.194806 -0.874716 \n", - "13 0.549337 -1.416101 -1.320003 -1.398806 \n", - "14 0.893184 1.063577 -0.580513 -0.128269 " + "0 0.405050 -0.038025 -1.144459 -0.437604 \n", + "1 0.222566 0.411477 -0.557221 0.407324 \n", + "2 -0.322209 0.063637 -1.028091 -0.392706 \n", + "3 -0.477164 1.966860 -0.018510 0.442490 \n", + "4 0.653350 -0.752011 -0.634769 -0.231503 \n", + "5 -0.702730 -1.838355 -0.810046 2.419473 \n", + "6 0.366755 0.530736 1.345358 0.515989 \n", + "7 -0.472871 -0.060746 1.754929 -1.009953 \n", + "8 -0.455428 -0.757432 -0.171152 0.803127 \n", + "9 -0.384104 -1.030702 0.015677 -0.808565 \n", + "10 -0.550000 1.082476 0.487512 -0.926261 \n", + "11 -0.705073 1.992426 -0.816416 0.532992 \n", + "12 0.197550 0.548611 0.334053 -1.498843 \n", + "13 -0.657099 -1.178905 0.795620 -0.974147 \n", + "14 0.869527 -1.843371 -2.446698 -1.428567 " ] }, - "execution_count": 5, + "execution_count": 18, "metadata": {}, "output_type": "execute_result" } @@ -590,7 +577,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -604,8 +591,8 @@ "\n", "\u001b[1mINFO:niftynet:\u001b[0m Image reader: loading 15 subjects from sections ['CT'] as input [image]\n", "\u001b[1mWARNING:niftynet:\u001b[0m This method will read your entire csv into memory\n", - "One sample from the csv_reader: [-1.67572209 -1.73029411 1.01353478 0.35487928 -1.0441231 0.65638927\n", - " 0.54933651 -1.41610099 -1.32000264 -1.39880624]\n", + "One sample from the csv_reader: [ 0.23841972 -0.96603888 -0.07318273 1.59560139 -0.09326917 -1.04853203\n", + " -0.65709902 -1.17890471 0.7956195 -0.97414747]\n", "\u001b[1mINFO:niftynet:\u001b[0m reading size of preprocessed images\n", "\u001b[1mWARNING:niftynet:\u001b[0m sampler queue_length should be larger than batch_size, defaulting to batch_size * 5.0 (10).\n", "(1, 100, 100, 1, 1, 1)\n", @@ -651,14 +638,13 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 20, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "\u001b[42m[Layer]\u001b[0m csv_reader_6 \u001b[46m(input undecided)\u001b[0m\n", "\u001b[1mINFO:niftynet:\u001b[0m \n", "\n", "Number of subjects 15, input section names: ['subject_id', 'CT']\n", @@ -711,6 +697,21 @@ "print(sample['features'].shape)\n" ] }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [], + "source": [ + "modalities = ['t1ce.', 't1.', 'flair.', 't2.']\n", + "def get_modality(string):\n", + " return modalities[[True if mod in string else False for mod in modalities].index(True)][:-1]\n", + " \n", + "files = [(file.replace('.nii.gz', ''), get_modality(file)) \\\n", + " for file in os.listdir('/home/tom/data/BRATS_18_SPLITS/train') if 'seg' not in file]\n", + "pd.DataFrame(data=files, columns=['subject_id', 'label']).to_csv('/home/tom/phd/NiftyNet-Generator-PR/NiftyNet/modality_labels.csv', index=None)\n" + ] + }, { "cell_type": "code", "execution_count": null, diff --git a/doc/source/config_spec.md b/doc/source/config_spec.md index 2c290952..57efe0dc 100644 --- a/doc/source/config_spec.md +++ b/doc/source/config_spec.md @@ -119,7 +119,7 @@ within each section. Name | Type | Example | Default ---- | ---- | ------- | ------- -[csv_file](#csv-file) | `string` | `csv_file=file_list.csv` | `''` +[csv_path_file](#csv-path-file) | `string` | `csv_path_file=file_list.csv` | `''` [path_to_search](#path-to-search) | `string` | `path_to_search=my_data/fold_1` | NiftyNet home folder [filename_contains](#filename-contains) | `string` or `string array` | `filename_contains=foo, bar` | `''` [filename_not_contains](#filename-not-contains) | `string` or `string array` | `filename_not_contains=foo` | `''` @@ -130,7 +130,7 @@ within each section. [spatial_window_size](#spatial-window-size) | `integer array` | `spatial_window_size=64, 64, 64` | `''` [loader](#loader) | `string` | `loader=simpleitk` | `None` -###### `csv_file` +###### `csv_path_file` A file path to a list of input images. If the file exists, input image name list will be loaded from the file; the filename based input image search will be disabled; [path_to_search](#path-to-search), @@ -221,8 +221,8 @@ with an interpolation order of `3`. A CSV file with the matched filenames and extracted subject names will be generated to `T1Image.csv` in [`model_dir`](#model-dir) (by default; the CSV -file location can be specified by setting [csv_file](#csv-file)). To exclude -particular images, the [csv_file](#csv-file) can be edited manually. +file location can be specified by setting [csv_path_file](#csv-path-file)). To exclude +particular images, the [csv_path_file](#csv-path-file) can be edited manually. This input source can be used alone, as a `T1` MRI input to an application. It can also be used along with other modalities, a multi-modality example diff --git a/niftynet/contrib/csv_reader/classification_application.py b/niftynet/contrib/csv_reader/classification_application.py index 173b9874..848fd7c3 100755 --- a/niftynet/contrib/csv_reader/classification_application.py +++ b/niftynet/contrib/csv_reader/classification_application.py @@ -269,7 +269,6 @@ def switch_sampler(for_training): data_dict = switch_sampler(for_training=True) image = tf.cast(data_dict['image'], tf.float32) - print(self.sampler[0][0]()['label']) net_args = {'is_training': self.is_training, 'keep_prob': self.net_param.keep_prob} net_out = self.net(image, **net_args) diff --git a/niftynet/io/image_reader.py b/niftynet/io/image_reader.py index e92ab90b..42cc344f 100755 --- a/niftynet/io/image_reader.py +++ b/niftynet/io/image_reader.py @@ -410,7 +410,7 @@ def _filename_to_image_list(file_list, mod_dict, data_param): if not volume_list: tf.logging.fatal( "Empty filename lists, please check the csv " - "files. (removing csv_file keyword if it is in the config file " + "files. (removing csv_path_file keyword if it is in the config file " "to automatically search folders and generate new csv " "files again)\n\n" "Please note in the matched file names, each subject id are " diff --git a/niftynet/layer/bn.py b/niftynet/layer/bn.py index fee050fd..01838504 100755 --- a/niftynet/layer/bn.py +++ b/niftynet/layer/bn.py @@ -135,5 +135,5 @@ def layer_op(self, inputs): variables_collections=None, outputs_collections=None, trainable=True, - data_format='NHWC', + data_format='NWC', scope=None) diff --git a/niftynet/layer/loss_classification.py b/niftynet/layer/loss_classification.py index 2deaedc5..80b8f7cc 100755 --- a/niftynet/layer/loss_classification.py +++ b/niftynet/layer/loss_classification.py @@ -79,6 +79,6 @@ def cross_entropy(prediction, :return: the loss """ ground_truth = tf.to_int64(ground_truth) - loss = tf.nn.sparse_softmax_cross_entropy_with_logits(logits=prediction, labels=ground_truth) + loss = tf.nn.sparse_softmax_cross_entropy_with_logits(logits=prediction, labels=ground_truth) return loss diff --git a/niftynet/layer/spatial_transformer.py b/niftynet/layer/spatial_transformer.py index 60c21a48..158f4a02 100755 --- a/niftynet/layer/spatial_transformer.py +++ b/niftynet/layer/spatial_transformer.py @@ -78,7 +78,6 @@ def layer_op(self,field): for d in [0, 1, 2]] resampled=tf.stack(resampled_list,5) permuted_shape=[batch_size]+[f-3 for f in self._coeff_shape]+self._knot_spacing+[spatial_rank] - print(permuted_shape) permuted=tf.transpose(tf.reshape(resampled,permuted_shape),[0,1,4,2,5,3,6,7]) valid_size=[(f-3)*k for f,k in zip(self._coeff_shape,self._knot_spacing)] reshaped=tf.reshape(permuted,[batch_size]+valid_size+[spatial_rank]) diff --git a/tests/image_reader_test.py b/tests/image_reader_test.py index 1610c0f5..3d2cb99b 100755 --- a/tests/image_reader_test.py +++ b/tests/image_reader_test.py @@ -18,7 +18,7 @@ # test multiple modalities MULTI_MOD_DATA = { 'T1': ParserNamespace( - csv_file=os.path.join('testing_data', 'T1reader.csv'), + csv_path_file=os.path.join('testing_data', 'T1reader.csv'), path_to_search='testing_data', filename_contains=('_o_T1_time',), filename_not_contains=('Parcellation',), @@ -28,7 +28,7 @@ loader=None ), 'FLAIR': ParserNamespace( - csv_file=os.path.join('testing_data', 'FLAIRreader.csv'), + csv_path_file=os.path.join('testing_data', 'FLAIRreader.csv'), path_to_search='testing_data', filename_contains=('FLAIR_',), filename_not_contains=('Parcellation',), @@ -43,7 +43,7 @@ # test single modalities SINGLE_MOD_DATA = { 'lesion': ParserNamespace( - csv_file=os.path.join('testing_data', 'lesion.csv'), + csv_path_file=os.path.join('testing_data', 'lesion.csv'), path_to_search='testing_data', filename_contains=('Lesion',), filename_not_contains=('Parcellation',), @@ -57,7 +57,7 @@ EXISTING_DATA = { 'lesion': ParserNamespace( - csv_file=os.path.join('testing_data', 'lesion.csv'), + csv_path_file=os.path.join('testing_data', 'lesion.csv'), interp_order=3, pixdim=None, axcodes=None, @@ -68,7 +68,7 @@ # test labels LABEL_DATA = { 'parcellation': ParserNamespace( - csv_file=os.path.join('testing_data', 'labels.csv'), + csv_path_file=os.path.join('testing_data', 'labels.csv'), path_to_search='testing_data', filename_contains=('Parcellation',), filename_not_contains=('Lesion',), @@ -82,7 +82,7 @@ BAD_DATA = { 'lesion': ParserNamespace( - csv_file=os.path.join('testing_data', 'lesion.csv'), + csv_path_file=os.path.join('testing_data', 'lesion.csv'), path_to_search='testing_data', filename_contains=('Lesion',), filename_not_contains=('Parcellation',), @@ -96,7 +96,7 @@ IMAGE_2D_DATA = { 'color_images': ParserNamespace( - csv_file=os.path.join('testing_data', 'images_2d_u.csv'), + csv_path_file=os.path.join('testing_data', 'images_2d_u.csv'), path_to_search=os.path.join('testing_data', 'images2d'), filename_contains=('_u.png',), interp_order=1, @@ -105,7 +105,7 @@ loader=None ), 'gray_images': ParserNamespace( - csv_file=os.path.join('testing_data', 'images_2d_g.csv'), + csv_path_file=os.path.join('testing_data', 'images_2d_g.csv'), path_to_search=os.path.join('testing_data', 'images2d'), filename_contains=('_g.png',), interp_order=1, @@ -114,7 +114,7 @@ loader=None ), 'seg_masks': ParserNamespace( - csv_file=os.path.join('testing_data', 'images_2d_m.csv'), + csv_path_file=os.path.join('testing_data', 'images_2d_m.csv'), path_to_search=os.path.join('testing_data', 'images2d'), filename_contains=('_m.png',), interp_order=0, diff --git a/tests/reader_modular_test.py b/tests/reader_modular_test.py index baf4a23b..de8f4841 100755 --- a/tests/reader_modular_test.py +++ b/tests/reader_modular_test.py @@ -138,7 +138,7 @@ def test_reader_field(self): def test_input_properties(self): data_param = {'mr': {'path_to_search': IMAGE_PATH_2D, - 'csv_file': '2d_test.csv'}} + 'csv_path_file': '2d_test.csv'}} reader = ImageReader().initialise(data_param) self.default_property_asserts(reader) idx, data, interp = reader() @@ -151,7 +151,7 @@ def test_input_properties(self): def test_no_2d_resampling_properties(self): data_param = {'mr': {'path_to_search': IMAGE_PATH_2D, - 'csv_file': '2d_test.csv', + 'csv_path_file': '2d_test.csv', 'pixdim': (2, 2, 2), 'axcodes': 'RAS'}} reader = ImageReader().initialise(data_param) @@ -199,7 +199,7 @@ class Read2D_1DTest(tf.test.TestCase): # loading 2d images of rank 3: [x, y, 1] def test_no_2d_resampling_properties(self): data_param = {'mr': {'path_to_search': IMAGE_PATH_2D_1, - 'csv_file': '2d_test.csv', + 'csv_path_file': '2d_test.csv', 'filename_contains': '_img', 'pixdim': (2, 2, 2), 'axcodes': 'RAS'}} @@ -282,7 +282,7 @@ class Read2D_colorTest(tf.test.TestCase): # loading 2d images of rank 3: [x, y, 3] or [x, y, 4] def test_no_2d_resampling_properties(self): data_param = {'mr': {'path_to_search': IMAGE_PATH_2D, - 'csv_file': '2d_test.csv', + 'csv_path_file': '2d_test.csv', 'filename_contains': '_u', 'pixdim': (2, 2, 2), 'axcodes': 'RAS'}}