nat icon indicating copy to clipboard operation
nat copied to clipboard

im3d should set dim on input data when possible

Open jefferis opened this issue 9 years ago • 3 comments

im3d(1:12, dims=c(2,3,4)) 

should give an array with real dimensions c(2,3,4).

jefferis avatar Feb 27 '15 12:02 jefferis

I think at some point should be doing:

if(length(x)>0) dim(x)=dims

although not sure if re-setting dims on large x is wasteful.

jefferis avatar Feb 27 '15 13:02 jefferis

Hmm, this is quite a tricky issue, because the dimension information is actually processed by im3d quite a bit, even when it has been passed explicitly by setting im3d(x, dims=). I have experimented with

  1. always setting it
  2. setting it if not already set
  3. setting it to exactly what was passed in as dims.

and none pass the present test suite. The place where things fall over is for imslice and projection when they result in a single 2d slice whereas the formal definition of im3d says that everything must be 3d and an extra singleton dimension is added if necessary.

jefferis avatar Mar 04 '15 10:03 jefferis

Does this mean we should be thinking about adding e.g.

  • imnd base class
  • im2d class

or perhaps switching to an e.g. im5d class, which is completely general?

jefferis avatar Mar 04 '15 10:03 jefferis