GriddedInterpolant and GridVectors turn image to binary?

조회 수: 2 (최근 30일)
Stelios Fanourakis
Stelios Fanourakis 2018년 7월 8일
댓글: Stelios Fanourakis 2018년 7월 15일
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
Jan
Jan 2018년 7월 12일
@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 2018년 7월 12일
편집: Stelios Fanourakis 2018년 7월 12일
@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.

댓글을 달려면 로그인하십시오.

답변 (3개)

Matt J
Matt J 2018년 7월 8일
편집: Matt J 2018년 7월 8일
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
Stelios Fanourakis
Stelios Fanourakis 2018년 7월 8일
Please see my last comment above
Stelios Fanourakis
Stelios Fanourakis 2018년 7월 15일
@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?

댓글을 달려면 로그인하십시오.


Stelios Fanourakis
Stelios Fanourakis 2018년 7월 9일
Nobody can help me on this?
  댓글 수: 9
Stelios Fanourakis
Stelios Fanourakis 2018년 7월 9일
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 2018년 7월 12일
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.

댓글을 달려면 로그인하십시오.


Stelios Fanourakis
Stelios Fanourakis 2018년 7월 9일
I gave all my resources and explanations. Anyone help? It is urgent. I don’t think it is so difficult. Come on
  댓글 수: 35
Jan
Jan 2018년 7월 14일
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 2018년 7월 15일
편집: Stelios Fanourakis 2018년 7월 15일
@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?

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by