changing dbf file scrambles the data - qgis

I used R to add attribute table information to a dbf file for a polygon shapefile.
Im not changing any original info in the file, just adding a couple of new columns.
When I overwrite the original dbf file the file size is much smaller then when i open the shapefile in QGIS all the attributes are scrambled and allocated to the wrong polygons.
WHat is happening here and how to fix it?

Related

How can I create a vtk structure point file from vtk unstructured grid file?

I have an unstructure grid in vtk file ( with legacy format), these file describe a points, cells and cell type. How can I generate a vtk structured point from this unstructure grid ?, or a 3d image file (with voxel information)?
You can start converting your vtkUnstructuredGrid to a vtkPolyData, see an example here . Then you can use vtkImplicitModeller to build a vtkImageData (voxels) from your vtkPolyData, see an example here . These are C++ examples, I'm sure you can find Python examples if needed.

Parsing for RGB regions over thousands of high resolution image files

I have lots of high resolution image files that have regions of colors, basically blobs with different rgb values. I need to go through the images and for every image make a text file that contains the coordinates to one pixel in every blob. Because I have so many files the script needs to be fast. I already wrote some scala code to do the task except it only saves locations for one blob per specific RGB value, meaning if I have two blobs of the same color that are not connected it will only save one the location for the first one found. The solution to this is for each images copy the location and colors to a map and when I find a blob flood delete (flood fill except delete instead of fill) and then keep parsing on the new map. However, I think this will make run time horribly slow because I will have to go through the entire image to add it to a map before even starting the parse. Thoughts? Am I going about this all wrong?
Thanks.

Extracting coordinates and metadata from mbtiles file

Since .mbtiles is raster data, is there possibility to extract this data and metadata contained in file (per point) to CSV or Excel file with coordinates + this additional metadata. So to have a row with:
lat: 123.123 long: 456.456 metadata: "Some metadata"
The best I can do is load .mbtiles file to QGIS, and now I'm trying to vectorize the layer and export single dots to coordinates. Problem is that dots are actually circles that sometimes overlap, so I cannot get exact position of all the dots. Also, I miss the metadata that is in .mbtiles files.
Thanks.
This is a onliner you probably look for (requires SQLite installed: http://www.sqlite.org/download.html):
% sqlite3 -header -csv world_countries.mbtiles -separator ; "select * from metadata;" > world_countries.csv

Convert dicom .dcm files into .obj format

I have sets of .dcm files of an MRI scan. I am trying to convert them into 3d formats like obj (preferably) or fbx to import them into Unity 3d. I used the following open source software dcmtk to convert .dcm file into text file.
Converting DICOM files to text files
However, the dcm files lack the needed information. Is it even possible to convert .dcm files to obj and fbx. if so, could you suggest something?
Thanks
(Edit)
I would like to put my question more precisely: I want to visualize MRI data as a 3D model in Unity 3d. This is possible only when I it stored as .obj or .fbx format. Which format of MRI medical data should I start with to convert to these formats?
Thanks
According to your previous comments you are looking for the necessary information in order to obtain the geometrical information of a DICOM series representing volumetric information (RM, TC, PET, ...)
In this case, you should have a look at the Roni Zaharia web site where he explains very clearly the concepts related to orientation and geometry of the DICOM images: DICOM is easy: Getting oriented
In this particular page you will find information about Pixel Spacing, Image Orientation, Image Position, Slice Thickness, and Slice Location, as well as additional information references.

How can I print out a large table of symbols from MATLAB to form a cross-stitch chart?

On this website, one can create stitch charts from images. I'm trying to do this in MATLAB. I have implemented everything using the Image Processing Toolbox (Reducing of number of the colors, mapping to the color space of available yarn colors). I'm done with all of this, the only thing I still need to do is to create an output similar to these files from MATLAB, which basically show which yarn to use for each raster point of the stitch chart:
BW
Color
My question is how to print a table with a lot of very small fields with the color and/or symbol inside.
It should look somehow like in these PDF files. How can I print out a table like this? Directly from MATLAB? Can I create a PDF file like this in MATLAB? Should I export it to Excel somehow?
For the "color" PDF you linked, this looks just like a pixelated image. Why don't you save each "field" as one pixel, for example in a TIF file using imwrite(I, 'filename')? You could then print this TIF into a PDF using an appropriate scaling factor to make the pixels large enough.
For the "BW" PDF which basically contains a large table of symbols, it would probably be easiest to go through HTML or RTF file format to get the table of symbols, and then use some html2pdf or rtf2pdf converter...