You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose we need to blacklist ROI labels 2 and 3 from the kurtosis feature extraction globally, in each image. The command line way to do that is using option __--skiproi__ :
As a result, the default feature extraction result produced without option --skiproi looking like
337
326
338
-
A separate command line executable "nyxushie" for the hierarchical ROI analysis by finding nested ROIs and aggregating features of child ROIs within corresponding parent features is available. Its command line format is:
327
+
<pre>
328
+
mask_image intensity_image label KURTOSIS
329
+
0 p0_y1_r1_c0.tif p0_y1_r1_c0.tif 1 -0.134216
330
+
1 p0_y1_r1_c0.tif p0_y1_r1_c0.tif 2 -0.130024<b>
331
+
2 p0_y1_r1_c0.tif p0_y1_r1_c0.tif 3 -1.259801
332
+
3 p0_y1_r1_c0.tif p0_y1_r1_c0.tif 4 -0.934786</b>
333
+
4 p0_y1_r1_c0.tif p0_y1_r1_c0.tif 5 -1.072111
334
+
.. ... ... ... ...
335
+
</pre>
336
+
337
+
will start looking like
338
+
339
+
<pre>
340
+
mask_image intensity_image label KURTOSIS
341
+
0 p0_y1_r1_c0.tif p0_y1_r1_c0.tif 1 -0.134216
342
+
1 p0_y1_r1_c0.tif p0_y1_r1_c0.tif 4 -0.934786
343
+
2 p0_y1_r1_c0.tif p0_y1_r1_c0.tif 5 -1.072111
344
+
3 p0_y1_r1_c0.tif p0_y1_r1_c0.tif 6 -0.347741
345
+
4 p0_y1_r1_c0.tif p0_y1_r1_c0.tif 7 -1.283468
346
+
.. ... ... ... ...
347
+
</pre>
348
+
349
+
350
+
Note the comma character separator <spanstyle="background-color:lightgrey"> <b>,</b> </span> in the blacklisted ROI label list.
351
+
352
+
If we need to blacklist ROI labels 15 and 16 only in image image421.tif ROI label 17 in image image422.tif, we can do it via a per-file blacklist :
Note the colon character <spanstyle="background-color:lightgrey"> <b>:</b> </span> between the file name and backlisted labels within this file and semicolon character separator <spanstyle="background-color:lightgrey"> <b>;</b> </span> of file blacklists.
343
357
344
-
*\<segment image collection dir\>* is directory of the segment images collection ;
358
+
<spanstyle="color:blue">Example 5:</span> __Skipping specified ROIs while extracting features (via Python API)__
345
359
346
-
*\<file pattern\>* is a regular expression to filter files in \<segment image collection dir\> ;
360
+
The Nyxus Python API equivalent of global ROI blacklisting is implemented by method __blacklist_roi(*string*)__ called before a call of method __featurize...()__, for example, labels 15, 16, and 17 can be globally blacklisted as follows:
361
+
```python
362
+
from nyxus import Nyxus
363
+
nyx = Nyxus(features=["KURTOSIS"])
364
+
nyx.blacklist_roi('15,16,17')
365
+
features = nyx.featurize_directory (intensity_dir="/path/to/intensity/images", label_dir="/path/to/mask/images", file_pattern=".*")
366
+
```
347
367
348
-
*\<channel signature\>* is a signature of the channel part in an image file name ;
368
+
Similarly, per-file ROI blacklists are defined in a way similar to the command line interface:
features = nyx.featurize_directory (intensity_dir="/path/to/intensity/images", label_dir="/path/to/mask/images", file_pattern=".*")
374
+
```
349
375
350
-
*\<parent channel\>* is an integer channel number where parent ROIs are expected ;
376
+
See also methods __clear_roi_blacklist()__ and __roi_blacklist_get_summary()__ .
351
377
352
-
*\<child channel\>* is an integer channel number where child ROIs are expected ;
378
+
## Nested features
353
379
354
-
*\<features dir\>* is a directory used as the output of parent-child ROI relations and, if aggregation is requested, where CSV files of Nyxus features produced with Nyxus command line option --csvfile=separatecsv is located ;
380
+
A separate command line executable __nyxushie__ for the hierarchical ROI analysis by finding nested ROIs and aggregating features of child ROIs within corresponding parent features is available. Its command line format is:
(optional) *\<aggregation method\>* is a method instructing how to aggregate child ROI features under a parent ROI.
386
+
*\<<u>segmentation dir</u>\>* is directory of the segment images collection \
387
+
*\<<u>file pattern</u>\>* is a regular expression to filter files in \<<u>segment image collection dir</u>\>\
388
+
*\<<u>channel signature</u>\>* is a signature of the channel part in an image file name \
389
+
*\<<u>parent channel</u>\>* is an integer channel number where parent ROIs are expected \
390
+
*\<<u>child channel</u>\>* is an integer channel number where child ROIs are expected \
391
+
*\<<u>features dir</u>\>* is a directory used as the output of parent-child ROI relations and, if aggregation is requested, where CSV files of Nyxus features produced with Nyxus command line option ```--csvfile=separatecsv``` is located \
392
+
(optional) *\<<u>aggregation method</u>\>* is a method instructing how to aggregate child ROI features under a parent ROI.
357
393
358
394
Valid aggregation method options are: SUM, MEAN, MIN, MAX, or WMA (weighted mean average).
359
395
360
-
__Example__: we need to process collection of mask images located in directory "\~/data/image-collection1/seg" considering only images named "train_.*\\.tif" whose channel information begins with characters "\_ch" (\_ch0, \_ch1, etc.) telling Nyxushie to treat channel 1 images as source of parent ROIs and channel 0 images as source of child ROIs. The output directory needs to be "\~/results/result1". The command line will be
396
+
<spanstyle="color:blue">Example 6:</span> __Processing an image set containing ROI hierarchy__
397
+
398
+
We need to process collection of mask images located in directory "\~/data/image-collection1/seg" considering only images named "train_.*\\.tif" whose channel information begins with characters "\_ch" (\_ch0, \_ch1, etc.) telling Nyxushie to treat channel 1 images as source of parent ROIs and channel 0 images as source of child ROIs. The output directory needs to be "\~/results/result1". The command line will be
@@ -375,7 +413,7 @@ The `featurize` method takes in the parent-child mapping along with the features
375
413
is provided to the constructor, this method will return a pivoted DataFrame where the rows are the ROI labels and the columns are grouped by the features.
376
414
377
415
378
-
__Example__: Using aggregate functions
416
+
__Example 7__: Using aggregate functions
379
417
380
418
```python
381
419
@@ -422,7 +460,7 @@ and the aggregated DataFrame is
@@ -461,7 +499,7 @@ the parent-child map remains the same but the `featurize` result becomes
461
499
462
500
Nyxus can either be build inside a `conda` environment or independently outside of it. For the later case, we provide a script to make it easier to download and build all the necessary dependencies.
463
501
464
-
### Inside Conda
502
+
### __Inside Conda__
465
503
Nyxus uses a CMake build system. To build the command line interface, pass `-DBUILD_CLI=ON` in the `cmake` command. For building with GPU support, use `-DUSEGPU=ON` flag in the `cmake` command. Here are the few notes on building with GPU support.
466
504
467
505
* Currently, GPU builds on Mac OS is not supported.
0 commit comments