Analysing proportion land coverage per raster cell from polygon layers in QGIS - qgis

I want to analyse the proportion of land use coverage of 12 different land use categories per raster cell. I want to do this for areas where a little owl was seen (owl location, value 1 in binary model) and areas where no owl was seen (owl absent, value 0 in binary model).I have a polygon layer that contains all values 0 (all areas where no owl was seen) and one for all values 1 (all areas where an owl was seen).
How can I extract the information I need from the data I have? Should I convert the polygon layers to rasters for example?
Absence layer:
Presence layer:
And this is a short example of what I want the output to look like:

Related

Calculate areas of new features in merged layer in QGIS

I have merged four different layers into one new one in QGIS, but I want this layer to have different information then the old layers. I want all the buffered 'islands' to have a different ID and a calculated area. However, now in the attribute table I just see four features, one for each layer that I merged. Is there a way to update the attribute table to consist of new features (one for each 'island')?
This is what the layer looks like:
And this is what the attribute table now looks like:
And this is what I want (the 5th and 6th column especially):
You must create a feature for each monopart geometry, you can achieve this using the 25.1.18.46. Multipart to singleparts tool, and then use the field calculator to get the area, you can find here how to calculate area Calculating polygon areas in shapefile using QGIS.

Biomedical Image Segmentation

In brain tumor segmentation,can I consider Images and Labels as color images?
Or images can have 3 channels but Ground Truth/ Mask/ Label must be in 1 channel. Or both must be of 1 channel?? As I have used both (images & GT) of 3 channels for UNET architecture, and giving me output as blank colored image. Why output is so?
There is no necessary to use colored images to perform biomedical image segmentation. The value of CT/MR image has a specific meaning, which denotes different lesions such as bones or vessels.
If you use 3 channels, I don't know whether the value still has the same meaning or not. Also, I do not recommend you take the GT as 3 channels image, because the voxel value denotes different classes. In your case, maybe 1-n for different kinds of tumors, 0 for background.
Thus, 3 channels representation will lose some semantic information, make the problem more complex.

How to adjust rows and columns, retaining cell sizes in arcmap?

The Situation: I have a vector data map with all the countries in the World, including a unique landcode for every country. I need to convert it into a raster map, so I can eventually analyse (with Matlab) drought indicators for that country.
The Problem: The precipitation data I use has 720 columns and 360 rows. I want the raster map of world countries to be in the exact same amount of columns and rows. BUT the raster map also needs to have a cellsize of 0.5! Right now, when I use the vector to raster conversion tool, if I use cellsize = 0.5, the columns and rows become 720x287.
Question: How can I create a raster map of 720 columns and 360 rows, while setting cellsize at 0.5?
Thank you in advance!
Additional info:
Using ArcMap 10.4.1 and Matlab R2015b
Raster is .TIFF
Vector is .shp
As a fellow GIS user I would recommend posting your question under the GIS stack exchange, https://gis.stackexchange.com/
Beyond that there is some clarification needed. Are you saying that you are trying to create a multi band raster with 1 band for each column?
I solved the problem. In ArcMap, I imported the precipitation data (NetCDF). It was however flipped, but I could get it in the right orientation using the tools 'Flip' and 'Rotate'. Now this map had the right orientation and the right amount of columns and rows. Furthermore I just altered some of the default settings in environments: 1) I set the processing extent to the precipitation data. 2) I set the snap raster also to the precipitation data. 3) I set the cellsize of every output raster to 0.5. Finally, I converted the vector file of world countries to a ASCII file using the raster to ascii conversion tool. The ASCII file now has the same amount of rows and columns as the precipitation data!

Interpolation between two images with different pixelsize

For my application, I want to interpolate between two images(CT to PET).
Therefore I map between them like that:
[X,Y,Z] = ndgrid(linspace(1,size(imagedata_ct,1),size_pet(1)),...
linspace(1,size(imagedata_ct,2),size_pet(2)),...
linspace(1,size(imagedata_ct,3),size_pet(3)));
new_imageData_CT=interp3(imagedata_ct,X,Y,Z,'nearest',-1024);
The size of my new image new_imageData_CT is similar to PET image. The problem is that data of my new image is not correct scaled. So it is compressed. I think the reason for that is that the pixelsize between the two images is different and not involved to the interpolation. So for example :
CT image size : 512x512x1027
CT voxel size[mm] : 1.5x1.5x0.6
PET image size : 192x126x128
PET voxel size[mm] : 2.6x2.6x3.12
So how could I take care about the voxel size regarding to the interpolation?
You need to perform a matching in the patient coordinate system, but there is more to consider than just the resolution and the voxel size. You need to synchronize the positions (and maybe the orientations also, but this is unlikely) of the two volumes.
You may find this thread helpful to find out which DICOM Tags describe the volume and how to calculate transformation matrices to use for transforming between the patient (x, y, z in millimeters) and volume (x, y, z in column, row, slice number).
You have to make sure that the volume positions are comparable as the positions of the slices in the CT and PET do not necsesarily refer to the same origin. The easy way to do this is to compare the DICOM attribute Frame Of Reference UID (0020,0052) of the CT and PET slices. For all slices that share the same Frame Of Reference UID, the position of the slice in the DICOM header refers to the same origin.
If the datasets do not contain this tag, it is going to be much more difficult, unless you just put it as an assumption. There are methods to deduce the matching slices of two different volumes from the contents of the pixel data referred to as "registration" but this is a science of its own. See the link from Hugues Fontenelle.
BTW: In your example, you are not going to find a matching voxel in both volumes for each position as the volumes have different size. E.g. for the x-direction:
CT: 512 * 1.5 = 768 millimeters
PET: 192 * 2.6 = 499 millimeters
I'll let to someone else answering the question, but I think that you're asking the wrong one. I lack context of course, but at first glance Matlab isn't the right tool for the job.
Have a look at ITK (C++ library with python wrappers), and the "Multi-modal 3D image registration" article.
Try 3DSlicer (it has a GUI for the previous tool)
Try FreeSurfer (similar, focused on brain scans)
After you've done that registration step, you could export the resulting images (now of identical size and spacing), and continue with your interpolation in Matlab if you wish (or with the same tools).
There is a toolbox in slicer called PETCTFUSION which aligns the PET scan to the CT image.
you can install it in slicer new version.
In the module's Display panel shown below, options to select a colorizing scheme for the PET dataset are provided:
Grey will provide white to black colorization, with black indicating the highest count values.
Heat will provide a warm color scale, with Dark red lowest, and white the highest count values.
Spectrum will provide a warm color scale that goes cooler (dark blue) on the low-count end to white at the highest.
This panel also provides a means to adjust the window and level of both PET and CT volumes.
I normally use the resampleinplace tool after the registration. you can find it in the package: registration and then, resample image.
Look at the screensht here:
If you would like to know more about the PETCTFUSION, there is a link below:
https://www.slicer.org/wiki/Modules:PETCTFusion-Documentation-3.6
Since slicer is compatible with python, you can use the python interactor to run your own code too.
And let me know if you face any problem

Perl - Ratio of homogeneous areas of an image

I would like to check whether an image has a lot of homogeneous areas. Therefore I would like to get some kind of value of an image that declares a ratio for images depending on the amount/size of homogeneous areas (e.g. that value could have a range from 0 to 5).
Instead of a value there could be some kind of classification as well.
[many homogeneous areas -> value/class 5 ; few homogeneous areas -> value/class 0]
I would like to do that in perl. Is there a package/function or something like that?
What you want seems to be an area of image processing research which I am not familiar with. However, GraphicsMagick's mogrify utility has a -segment option:
Use -segment to segment an image by analyzing the histograms of the color components and identifying units that are homogeneous with the fuzzy c-means technique. The scale-space filter analyzes the histograms of the three color components of the image and identifies a set of classes. The extents of each class is used to coarsely segment the image with thresholding. The color associated with each class is determined by the mean color of all pixels within the extents of a particular class. Finally, any unclassified pixels are assigned to the closest class with the fuzzy c-means technique.
I don't know if this is any use to you. You might have to hit the library on this one, and read some research. You do have access to this through PerlMagick as well. However, it does not look like it gives access to the internals, but just produces an image based on parameters.
In my tests (without really understanding what the parameters do), photos turned entirely black, whereas PNG images with large areas of similar colors were reduced to a sort of an average color. Whether you can use that fact to develop a measure is an open question I am not going to investigate ;-)