Comments (2)
I haven't tried isolating this in such a way, and without knowing the biological question you have it's hard to suggest something, but maybe you could just "crop" the full heatmap around that region?
from clearmap.
Here is how I did it.
I have a .csv file with the list of regions I want to show in the heatmap. It has to be a list with the regions' number. In the zipped registration file you download from https://idisco.info/clearmap-2/ you have a file called regions IDs.csv they have all the codes of the regions in there.
Next, in the parameter_file_template.py file, I inserted the following piece of code in the end
in the code, heatmap_ids.csv is MY list of regions of interest
# CESAR'S VARIABLES for visualizing counted cells in specific regions
outside = 0
with open('/home/cesar/Image_analysis/Python/Registration/parameter_25um/heatmap_ids.csv') as f:
region = list(csv.reader(f, delimiter = ";"))
region = numpy.array(region, dtype = numpy.int)
Then, in the process_template.py, the piece of code that generates the heatmap and saves it
# Heat map generation
#####################
points = io.readPoints(TransformedCellsFile)
intensities = io.readPoints(FilteredCellsFile[1])
#Without weigths:
vox = voxelize(points, AtlasFile, **voxelizeParameter);
if not isinstance(vox, basestring):
io.writeData(os.path.join(BaseDirectory, 'cells_heatmap.tif'), vox.astype('int32'));
#With weigths from the intensity file (here raw intensity):
voxelizeParameter["weights"] = intensities[:,0].astype(float);
vox = voxelize(points, AtlasFile, **voxelizeParameter);
if not isinstance(vox, basestring):
io.writeData(os.path.join(BaseDirectory, 'cells_heatmap_weighted.tif'), vox.astype('int32'));
I replaced that whole block of code for the following:
# Heat map generation
#####################
from ClearMap.Alignment.Resampling import sagittalToCoronalData
points = io.readPoints(TransformedCellsFile)
intensities = io.readPoints(FilteredCellsFile[1])
vox = voxelize(points, AtlasFile, **voxelizeParameter);
#### CESAR'S CODE
### In this piece, the heatmap generated affects only the regions defined in the variable region
label = io.readData(AnnotationFile);
label = label.astype('int32');
labelids = numpy.unique(label);
for l in labelids:
if not numpy.in1d(l,region): # matches the annotation file to list of regions of interest
outside = numpy.logical_or(outside, label == l); #this works for multiple brain regions
vox[outside] = 0;
io.writeData(os.path.join(BaseDirectory, 'cfos/overlays.mhd'), sagittalToCoronalData(vox.astype('int16')));
io.writeData(os.path.join(BaseDirectory, 'cfos/annotation_to_overlay.mhd'), sagittalToCoronalData(label.astype('int16')));
Now, just note that the heatmap is going to be saved in the coronal dimensions.
If you still want it in the sagital plan, remove the sagittalToCoronalData()
function from the two last lines and you are good.
from clearmap.
Related Issues (20)
- No module named 'Cython' HOT 8
- elastix library not loaded (MacOSX) despite existing in path HOT 1
- Python crashes during resampling
- TIFFReadDirectory warning: Unknown field with tag 50838 HOT 1
- 'OverflowError('cannot serialize a string larger than 2 GiB',)
- annotated counts not registering to csv
- Too many files open
- itk::ERROR: RandomCoordinateSampler Please select a smaller SampleRegionSize!
- no
- Two of the Unlabelled regions actually labels parts of two different regions
- Problems with Elastix HOT 2
- problems with the Analysis script HOT 2
- findCenterOfMaxima returns non integer center coordinates, which are not valid in voxelizePixel function
- Issue with Installation, setting.py specifically HOT 3
- Interfacing Ilastik
- ClearMap can't find my .ilp file for celldetection
- Elastix runtime error
- ImportError: cannot import name 'Texture3D' from 'vispy.visuals.volume' HOT 2
- Error during Transform point coordinates with 'elastix_input.txt'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clearmap.