Shrink 3D wave to cube


I have 3D wave with some object composed of 1s in it (default pixel value is 0) and I am using 

ImageTransform/F=0 shrinkBox Wave3Large

to shrink to smallest possible size. However, this results in wave which may have each dimension different size - 221, 261, 211 - in my current test case. But I want to make the resulting wave a cube, that is all sides same sizes, in this case 261. What is fast way to do this? Shrink and then pad as needed? Is there better way I am not seeing?  

I do not know anything about the size of the object inside, so shrinkBox is great in its flexibility. Finding the object size inside would be bit of nightmare. 

Hello Jan,

The fastest way to "pad" the box is to insert known bogus data at the desired (pad) vertices.  After executing the shrinkBox you simply remove the inserted vertices (they will be at the corners).  Note that before inserting these you may want to create a 4 point wave and store a marker for the case that the corner is already occupied.



So it sounds like the sequence should be: shrink original data; find largest dimension; pad original data at that point in all dimensions; shrink again; removed pad data.

Thanks for the suggestions.

I will do testing on the suggestion. My first (brute force) solution was to create a new 3d wave with all dimensions = largest dimension of shrinked wave and insert the shrinked data properly offset to be in the center (that is useful for display purposes). I will test how fast the proposed method is as these 3d waves can get bit large.