How to create the mask from the 3D contour points into the 3D volume? - binary

I have three dimensional data points of the structure file. I want to plot the structure of that file and say that the voxel value inside the contour points is 0 and outside the contour points is 1. These are the data.
enter image description here

Related

Getting a surface graph from a json file in gnuplot

I'm not a dev, I'm doing this for a school project. I'm trying to put the following dataset into a surface plot in windows gnuplot. qt type terminal, if that's important.
https://files.catbox.moe/nbc6l1.json
As you can see, it's a huge set of data. Pulled directly from an image and into a csv file, which I converted to json.
When I type in "splot 'C:\Users\tyler\ESRP Data\sampleOutput.json'", this is what I get.
As you can see, there's only a single line, when there should be something approaching an intensity chart in a 3 dimensional space. Is it a problem with the data? Do I need a specific command to do this?
It would help if you attached an example of your image data to the question, and also if you provided a link to a plot similar to the one you are trying to create. There are many different styles one might use to represent a surface. I will attempt to guess at a possible solution.
Input image (scribbled in GIMP and saved as a png image):
Gnuplot surface plot:
set border -1
unset tics
# surface represented by colored lines in 3D
# down-sample by 4x in each dimension to get an interpretable surface
set palette defined (0 "blue", 1 "white")
splot 'scribble.png' binary filetype=png every 4:4:4 using 1:2:3:3 with lines lc palette

QGIS field calculator interpolating over raster

I want to add a z field to my shapefile. Z value is the elevation of the center of the basin. I wonder how should I acomplish that. x and y values of the centroids are in the table. I have the dem of the region.
You'll have to convert those xy coordinates to a point feature class and then you can use the 'Point sampling tool' plugin to assign the value of your basin raster/polygon to each point (similar to the 'Extract Values to Points' tool in ArcGIS).
You can query the raster directly in Field Calculator. Create a new field and populate with:
raster_value('Raster', 1, make_point( x(centroid($geometry)), y(centroid($geometry))))
'Raster' is the raster layer, 1 is the band in the raster layer to use, and the make_point() function generates the centroid.

Preparing dataset with MultiLabels for classification in caffe

I am trying to build multilabel classifier so I would be able to identify and count objects in the picture. I have my own dataset that I have collected, and I labeled regions.
For the sake of simplicity, this is an example. Let's say that I am building a classifier to classify dogs and cats that appear in the same image, I have prepared the dataset in a way that I define regions.
if the image's size is 1200*1200
First region: [[0,600],[0,1200] will be labeled as a 0 (cat),
Second region: [[600,1200],[0,1200] will be labeled as a 1 (dog).
By reading this example in here, I couldn't figure out how to define regions so I train the classifier to know that an object X is in region [x,y,w,z] ?
Preparing the script this way would help me to categorize the image, but it wouldn't help counting number of objects in the image
Any help would be appreciated.

Sketchup 3D Models, DEM and Netlogo GIS Extension

Bit of a challenge here which I've been grappling with for some time. I'll explain my full work flow so you can reproduce if needed.
I'm creating virtual landscapes in Google SketchUp which I ultimately would like to use in Netlogo to examine how turtles interact with them.
My problem is that by the time I get the landscapes into Netlogo the units don't seem to relate to the original 3D model.
Step 1: Create simple hill on a 50m by 50m square in Sketchup using the Toposhaper extension.
Step 2: Export to .dae file and import into Meshlab, ensure the Meshlab model has the same dimensions as the Sketchup model by adjusting the units with the assistance of the measuring tool. Export from meshlab as .xyz file.
Step 3: Import .xyz file into QGis as points by adding a new layer from delimited file. Selecting field_1 and field_2 as X and Y fields.
Step 4: Create raster of points using Raster > Interpolation > Interpolation. Add field_3 as interpolation attribute, set number of columns to 50 by 50 (to correspond to the 50m x 50m 3D model), adjust cell size X and Y to match to ensure Netlogo will read the resulting .asc file.
Step 5: Finally, I setup a model in Netlogo to receive the raster. Firstly, in model settings I set the the min and max pxor and pycor to 0 and 50. Then, using the Gis Extension, I import the raster apply the z-value to a patch variable called elevation:
to load-gis
set elevation gis:load-dataset "cone_50.asc"
gis:set-world-envelope-ds gis:envelope-of elevation
gis:apply-raster elevation target-elev
end
Now, each patch of my 50 by 50 Netlogo world should have an elevation value taken from my 50 by 50 raster. In theory, adding all the elevation values together should (roughly) give me the total volume of the raised area of the hill? The figure I get is higher however and the problem gets worse with larger volumes.
Can anyone help?

Multidimensional interpolation

Given a dataset of samples in a multi dimensional space (in my case a 4D space) where the samples are present on all the corners of the 4D cube and a substantial amount of samples within this cube but not in a neatly grid. Each sample has an output value next to it's 4D coordinate. The cube has coordinates [0,0,0,0]..[1,1,1,1].
Given a new coordinate (4D) how can I come up with the best interpolated value given these samples? Eg how do I choose the samples to start with, how to interpolate.
As a first guess I would guess that this can be done with a two step process:
find the smallest convex pentachoron (4D equivalent of the 3D tetrahedron / the 2D triangle) around the coordinate we need to interpolate.
interpolate within this tetrahedron.
Especially step 1 seems quite complex and slow.
Here's the first approach I'd try.
Step 1
Find the point's 4 nearest neighbors by Euclidean distance. It's important that these 4 points are linearly independent because next they're used to create a Barycentric coordinate system. Those 4 points become the vertices of your pentachoron (aka 4-simplex).
If nearest-neighbor checks are too slow, try structuring your data into a spatial lookup tree that works in 4D.
Step 2
Now we need to associate a value with the interpolation point X. Start by deriving X's representation in this new Barycentric coordinate system. This Barycentric coordinate consists of 4 numbers, which collectively describe the relative distance between the interpolation point and each of the 4-simplex's vertices.
Normalize the Barycentric coordinate so its components sum to 1.
Each of those 4 simplex vertices are data points and have an output value. Combine those 4 output values into a vector.
Finally, interpolate by calculating the dot product of the normalized coordinate with the vector of output values.
Source: This idea is really just a 4D extension of this gem in middle of the Barycentric coordinate system page on Wikipedia.