FNNDSC / ami

AMI Medical Imaging (AMI) JS ToolKit
https://fnndsc.github.io/ami/#viewers_upload
MIT License
719 stars 213 forks source link

MIP method of thicknessMethod probably don't consider the current slice orientation #392

Open andy23512 opened 5 years ago

andy23512 commented 5 years ago

Description

When using MIP method (default thickness method with some >0 thickness slice setting) with non-axial slice, it displays some repeated pattern. It seems like the direction that max intensity is calculated is not perpendicular to the slice plane. I am not sure if this is the expected result of MIP, or it is really a bug.

For example, this is a part of coronal view without MIP method (slice thickness = 0) mipoff And when MIP method is turned on, the pattern are repeated (and there is no such problem in the axial view).
mipon

Live Demo

Similar behavior can be found in the geometries slice example. Set thickness to some value > 10. In some direction, you would see some ripple-like pattern and the bright area seems expanded.

Screen Shot 2019-08-29 at 00 31 47

Browsers Affected

Versions

NicolasRannou commented 5 years ago

Interesting, so I guess the normal is not set properly anymore at: https://github.com/FNNDSC/ami/blob/master/src/shaders/shaders.data.vertex.js#L8

It only works in 1 direction right?

Maybe we must also attach the normals here: https://github.com/FNNDSC/ami/blob/master/src/geometries/geometries.slice.js#L113

or call .computeVertexNormals ().

Can you call '.computeVertexNormals () ' then '.normalizeNormals ()' on the buffer geometry of the slice in your code .to see if that helps?

andy23512 commented 5 years ago

Thanks for the rapid response. Call '.computeVertexNormals () ' then '.normalizeNormals ()' works in the geometries_slice example. But it does not work for the code I am working on (It's a more complex case that loading a coronal-direction stack). At least now I have some hint for solving it.

andy23512 commented 5 years ago

Ok. After some tries, I think the problem in my case is not caused by the normal vector not updated. In my case, there are two views, axial view and coronal view. When I load an axial-direction stack, there is no problem in both views when using MIP method. But when I load a coronal-direction stack, there is problem (as mentioned above) in coronal view when using MIP method. My thought is if the direction of normal vector is correctly updated (since no problem when loading axial-direction stack), then the problem might be the data direction is not consistent with the three.js world direction. Is there any hint to figure this out or one coronal-direction dicom image to reproduce this problem?

andy23512 commented 5 years ago

I've generated a fake dicom file (with coronal direction stack). It has black-white stripe image at odd index, and whole gray image at even index. So if the MIP is correctly applied, the expected result should be gray-white stripe image.

But the behavior is that the white area expands as the thickness increases. The result can be viewed at https://codesandbox.io/embed/ami-lesson-03-tz610.

ikkyunsong commented 3 years ago

I am struggling with this issue. I am wondering if this issue has been resolved.

ikkyunsong commented 3 years ago

Hi,

Thanks for the reply. I used that method, but it didn't work though I don't know if I called the function properly. In my code, what I did:

this.stackHelper.orientation = this.camera.stackOrientation; // Change orientation this.stackHelper.slice.geometry.computeVertexNormals(); // As suggested this.stackHelper.slice.thickness = 5.1; // Change slice thickness

After this, the issue is not resolved.

I tested this on the lesson in GitHub (https://codesandbox.io/s/github/FNNDSC/ami/tree/master/lessons/03) as well. I added the following to the end of the code. It seems that the thickness change works well in axial, but not in coronal and sagittal orientations.

stackFolder .add(stackHelper.slice, 'thickness', 0, 30) .step(0.3) .listen();

I am wondering if you know how to resolve the issue.

Thanks, Ikkyun

On Sat, Feb 13, 2021 at 11:41 AM omerravid notifications@github.com wrote:

I am struggling with this issue. I am wondering if this issue has been resolved.

the solution is to call the following after updating the slice direction plane: stackHelper.slice.geometry.computeVertexNormals()

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/FNNDSC/ami/issues/392#issuecomment-778651327, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADUG2WMWK36YXUUPD7HMELLS622TXANCNFSM4IRNFI3Q .