GriddedInterpolant and GridVectors turn image to binary?

1 Ansicht (letzte 30 Tage)
Stelios Fanourakis
Stelios Fanourakis am 8 Jul. 2018
Can someone please tell me if GriddedInterpolant and or GridVectors turn an image to binary format. Why is this happening and how can it be reversed?
I use that code line
t = double(im2)
F=griddedInterpolant(t);
g=F.GridVectors;
Where im2 is my original image
  18 Kommentare
Jan
Jan am 12 Jul. 2018
@Stelios: Anywhere in your workflow is a problem. You cannot find out, where it is, so you have posted the code, such that the readers can find the point. But the posted code does not allow an identification, if it is confusing and weakly written.
The original question was:
tell me if GriddedInterpolant and or GridVectors turn an image to
binary format
It did not get clear, what this means or why you have this impression. I still assume the best answer is "no, they do not convert the image to binary format".
I give up here.
Stelios Fanourakis
Stelios Fanourakis am 12 Jul. 2018
Bearbeitet: Stelios Fanourakis am 12 Jul. 2018
@Jan. I really do appreciate the time and effort you put in order to help me, but, if you feel that in any way I cause you frustration, again, I remind you that is not obligatory by your side to respond to my questions. If you can understand the problem and have a valid solution, then, you are more than welcome to provide it. Other may also benefit.
My code is fine. It may needs a bit of cleaning and simplification but it is a very strong code that works and gives the outcome I'd like. It is only that specific part of code I don't understand and needs to be modified. The code is more than fine.

Melden Sie sich an, um zu kommentieren.

Antworten (3)

Matt J
Matt J am 8 Jul. 2018
Bearbeitet: Matt J am 8 Jul. 2018
The answer is no, griddedInterpolant cannot change the data type of the input. As you can see in the examples below, if the input to griddedInterpolant are single floats, then the output will be single as well. Likewise, if the input is double, the output will be double. You can do a similar check on any other input data you are interested in.
>> in=rand(3,'single'); F=griddedInterpolant(in); out=F(2.5,2.5); whos in out
Name Size Bytes Class Attributes
in 3x3 36 single
out 1x1 4 single
>> in=rand(3); F=griddedInterpolant(in); out=F(2.5,2.5); whos in out
Name Size Bytes Class Attributes
in 3x3 72 double
out 1x1 8 double
Similarly, GridVectors cannot be responsible for a change in input-to-output type/precision. GridVectors is not even a function. It is a property of the griddedInterpolant class.
  2 Kommentare
Stelios Fanourakis
Stelios Fanourakis am 8 Jul. 2018
Please see my last comment above
Stelios Fanourakis
Stelios Fanourakis am 15 Jul. 2018
@Matt. I though of another solution. When I use result = F(g) I apply interpolation again to g which are the original set points (image) multiplied by translation_vector.
That means that the original image has already been shifted plus a new interpolation coming on the way (F(g)). Does it make it somehow to be smushed or squeezed?
If I visualize with only g without F(g) I get errors later on to the uicontrol of the slider (e.g. Index Exceeds Matrix Dimensions).
Would it be correct to visualize only with g?

Melden Sie sich an, um zu kommentieren.


Stelios Fanourakis
Stelios Fanourakis am 9 Jul. 2018
Nobody can help me on this?
  9 Kommentare
Stelios Fanourakis
Stelios Fanourakis am 9 Jul. 2018
Just use Img=DicomReader('1st image name') and then im2 = makeImIsoRGB(Img,[1,1,15],2.0,'cubic') to get the im2 and then apply the rest of the code.
Jan
Jan am 12 Jul. 2018
I don't care which thread my topic is, as long as it gets resolved.
While you do not care, the readers do. Posting multiple threads is confusing an the readers loose the overview. This is not an efficient method to use the work of voluntary helpers.

Melden Sie sich an, um zu kommentieren.


Stelios Fanourakis
Stelios Fanourakis am 9 Jul. 2018
I gave all my resources and explanations. Anyone help? It is urgent. I don’t think it is so difficult. Come on
  35 Kommentare
Jan
Jan am 14 Jul. 2018
tell me if GriddedInterpolant and or GridVectors turn an image to
binary format
u = unique(im2)
if isequal(u, [0, 1]) % Binary
answer = 'yes'
else
answer = 'no'
end
Stelios Fanourakis
Stelios Fanourakis am 15 Jul. 2018
Bearbeitet: Stelios Fanourakis am 15 Jul. 2018
@Jan. The answer to what you gave me is NO. But I am not sure if I can rely 100% on this since im2.mat that remained in my Workspace, by the time I applied that code was before the GriddedInterpolant implementation.
Let's move on. Shall we?
I have another assumption. im2 is a 4D interpolated stack of images (stack out of 15 images) using interp3.
Interpolation to me, means that it creates in between images. For example, if there is 1 to 2 image, the interpolation will give us 1.5 image. Am I correct? So that's what interp3 does. It increases the number of images above 15, where they really are.
Then, by importing im2 to GriddedInterpolant, again another interpolation takes place, so even more subimages are created. Thus, the total number of slices that consist the stack may exceed 30, but, definitely it won't be 15 where it started.
Then, with GridVectors I turn it to cell array and by multiplying with the translation_vector, supposedly they are shifted. BUT, the translation_vector matrix is consisted out of 15 rows and 2 columns. 15 rows as the original images NOT the interpolated ones. So, a lot of images do not shift.
Am I right to my assumption. Is this more clear so we can find a solution?

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by