Hello,
I have a image data, with unecessary excess data as it can be seen in the image:
the image have as extends: 1972 x 1972 x 1 (just testing on one slice)
so I would like to:
- cutout the excess undesired data (so make a square that is just slightly larger than the circle)
- move to 0,0,0 the begining (so the BB is equal to the bounds of it)
For this I am doing the following steps but I am pretty sure that it is not the correct way to do it:
- define the size of the small square and its center
- crop the data to the square
- move the min corner to the 0,0,0 with transform
- resample to image (to make it an image again)
- save data
there is some issues with this,
- the crop filter show in Information the same values (of bounds/extend) as the original image, but if i show in the spreadsheet it is smaller in number of cells and points, so… is it really removing the unecessary data or not?
- the moving with transform, transforms the data to Structured (Curvilinear) Grid so i need the resample to image
- when doing the resample to image the minimum position get lost by a small dimensions (it goes from [0,0,0] to [0.0008449999731965363, 0.0008449999731965363, 0.0])
my current code:
c = [980, 930, 0]
b = [1690, 1690, 1]
f = GetActiveSource()
crop1 = Crop(Input=f)
crop1.OutputWholeExtent = [int(i) for i in [c[0]- b[0]/2, c[0] + b[0]/2, c[1]- b[1]/2, c[1] + b[1]/2, 0, 0]]
transform1 = Transform(Input=crop1)
transform1.Transform.Translate = [-(c[0]- b[0]/2), -(c[1]- b[1]/2), -c[2]]
resampleToImage1 = ResampleToImage(Input=transform1,SamplingDimensions = [b[0], b[1], 1])
and here is a slice as example:
slice00000.tif (7.4 MB)
