Skip to content

Commit

Permalink
Merge pull request #65 from BodenmillerGroup/development
Browse files Browse the repository at this point in the history
Fix image rescaling bug
  • Loading branch information
votti authored May 10, 2021
2 parents 94c21fe + d88d509 commit 29d494b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 9 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ you to be considerate and give us and others feedback if you find a bug or issue
on the affected projects or on this page.

## Changelog
- v2.1:
- Bugfixes:
- 1_prepare_ilastik: Fix range to 0-1 for mean image, preventing out of range errors

- v2.0:
- Change to imctools v2:
- Changes the structure of the folder to the new format, changing the
Expand Down
37 changes: 28 additions & 9 deletions cp4_pipelines/1_prepare_ilastik.cppipe
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CellProfiler Pipeline: http://www.cellprofiler.org
Version:5
DateRevision:406
GitHash:
ModuleCount:12
ModuleCount:13
HasImagePlaneDetails:False

Images:[module_num:1|svn_version:'Unknown'|variable_revision_number:2|show_window:False|notes:['This module will prepare ilastik stacks for the ilastik cell classification pipeline.']|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
Expand Down Expand Up @@ -65,19 +65,38 @@ SmoothMultichannel:[module_num:5|svn_version:'Unknown'|variable_revision_number:
Hot pixel threshold:50.0
Scale hot pixel threshold to image scale?:Yes

SummarizeStack:[module_num:6|svn_version:'Unknown'|variable_revision_number:1|show_window:False|notes:["This calculates an 'average' of all channels and multiplies it with 100.", 'Thus an average count of 0.1 (over all channels) will correspond to 10 in an uint16 image.', '', 'This allows to easily discriminate forground and background.', '']|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
SummarizeStack:[module_num:6|svn_version:'Unknown'|variable_revision_number:1|show_window:False|notes:["This calculates an 'average' of all channels and multiplies it with 100.", 'Thus an average count of 0.1 (over all channels) will correspond to 10 in an uint16 image.', '', 'This allows to easily discriminate forground and background.', '', 'These images can be outside of the allowed 0-1 range, thus they will be truncated to the valid range in the following ImageMath module.']|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
Select the input image:IlastikFil
Conversion method:Python Function
Name the output image:ScaledMean
Name the output image:ScaledMeanPrep
Input a Python function:lambda x, axis: np.mean(x, axis=axis)*100

StackImages:[module_num:7|svn_version:'Unknown'|variable_revision_number:2|show_window:False|notes:['Add the summary channel as first channel.']|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
ImageMath:[module_num:7|svn_version:'Unknown'|variable_revision_number:5|show_window:False|notes:['This guarantees that values will be between 0-1']|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
Operation:None
Raise the power of the result by:1.0
Multiply the result by:1.0
Add to result:0.0
Set values less than 0 equal to 0?:Yes
Set values greater than 1 equal to 1?:Yes
Replace invalid values with 0?:Yes
Ignore the image masks?:No
Name the output image:ScaledMean
Image or measurement?:Image
Select the first image:ScaledMeanPrep
Multiply the first image by:1.0
Measurement:
Image or measurement?:Image
Select the second image:None
Multiply the second image by:1.0
Measurement:

StackImages:[module_num:8|svn_version:'Unknown'|variable_revision_number:2|show_window:False|notes:['Add the summary channel as first channel.']|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
Name the output image:IlastikExp
Hidden:2
Image name:ScaledMean
Image name:IlastikFil

Resize:[module_num:8|svn_version:'Unknown'|variable_revision_number:4|show_window:False|notes:['Scaling up the images 2x makes pixel classificaiton easier.']|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
Resize:[module_num:9|svn_version:'Unknown'|variable_revision_number:4|show_window:False|notes:['Scaling up the images 2x makes pixel classificaiton easier.']|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
Select the input image:IlastikExp
Name the output image:Ilastik2x
Resizing method:Resize by a fraction or multiple of the original size
Expand All @@ -89,7 +108,7 @@ Resize:[module_num:8|svn_version:'Unknown'|variable_revision_number:4|show_windo
Select the image with the desired dimensions:None
Additional image count:0

CropImage:[module_num:9|svn_version:'Unknown'|variable_revision_number:4|show_window:False|notes:['This function crops random sections from the images, that are used for training.', '', 'The filename is used as a random seed.']|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
CropImage:[module_num:10|svn_version:'Unknown'|variable_revision_number:4|show_window:False|notes:['This function crops random sections from the images, that are used for training.', '', 'The filename is used as a random seed.']|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
Select the input image:Ilastik2x
Name the output image:Ilastikcropped
W width:500
Expand All @@ -100,7 +119,7 @@ CropImage:[module_num:9|svn_version:'Unknown'|variable_revision_number:4|show_wi
Optional Random Seed:\g<filename>
Additional image count:0

SaveImages:[module_num:10|svn_version:'Unknown'|variable_revision_number:15|show_window:False|notes:[]|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
SaveImages:[module_num:11|svn_version:'Unknown'|variable_revision_number:15|show_window:False|notes:[]|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
Select the type of image to save:Image
Select the image to save:Ilastik2x
Select method for constructing file names:From image filename
Expand All @@ -119,7 +138,7 @@ SaveImages:[module_num:10|svn_version:'Unknown'|variable_revision_number:15|show
Base image folder:Elsewhere...|
How to save the series:T (Time)

SaveImages:[module_num:11|svn_version:'Unknown'|variable_revision_number:15|show_window:False|notes:['Saves the crop together with the coordinates.', 'This is important to track back were the random crops were exactly taken.']|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
SaveImages:[module_num:12|svn_version:'Unknown'|variable_revision_number:15|show_window:False|notes:['Saves the crop together with the coordinates.', 'This is important to track back were the random crops were exactly taken.']|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
Select the type of image to save:Image
Select the image to save:Ilastikcropped
Select method for constructing file names:From image filename
Expand All @@ -138,7 +157,7 @@ SaveImages:[module_num:11|svn_version:'Unknown'|variable_revision_number:15|show
Base image folder:Elsewhere...|
How to save the series:T (Time)

CreateBatchFiles:[module_num:12|svn_version:'Unknown'|variable_revision_number:8|show_window:False|notes:[]|batch_state:array([], dtype=uint8)|enabled:False|wants_pause:False]
CreateBatchFiles:[module_num:13|svn_version:'Unknown'|variable_revision_number:8|show_window:False|notes:[]|batch_state:array([], dtype=uint8)|enabled:False|wants_pause:False]
Store batch files in default output folder?:Yes
Output folder path:/mnt/f2160748-a937-44bd-aca8-3adb8a839612/Data/Analysis/cp4_segmentation_example/cpout
Are the cluster computers running Windows?:No
Expand Down

0 comments on commit 29d494b

Please sign in to comment.