GithubHelp home page GithubHelp logo

Comments (14)

jcreinhold avatar jcreinhold commented on June 26, 2024

MD is "mean diffusivity" a type of diffusion image.

I can add a note somewhere in the docs, but, in general, if you don't know what an option is, don't select it because it's probably not the right one for your use case.

Are you just wondering what MD is out of curiosity? Or did not knowing what MD is somehow impact your use of this package?

from intensity-normalization.

Siji-chl avatar Siji-chl commented on June 26, 2024

Thank you very much for your reply! I konw that MD is "mean diffusivity" a type of diffusion image, but I can't figure it out when it is listed together with t1, t2, FLAIR...ahh! And to my knowledge, MD is also a type of quantitative image, does it need to be mormalized?

Actually, I'm normalizing CE-T1WI using the package. In your recommendation, one should find a tissue that is not affected by the contrast (e.g., grey matter) and normalize based on some summary statistic of that. So I choose FCM method to find grey matter on T1WI (set "tissue_type='gm'"), then normalize CE-T1WI based on summary statistic of the grey matter on T1WI (set "modality='other'"). Am I right?

Umm... I m very sorry that I encountered another problem when I used WhiteStripe method. My code is as following
whitestripe = WhiteStripeNormalize(norm_value=scale) normalized = whitestripe(image, mask)
image and mask is loaded by nib.load(), and scale=100.
Then I met one warning and one error:
warnings.warn("norm_value not used in RavelNormalize")
TypeError: '>' not supported between instances of 'Nifti1Image' and 'float'
I m confused that why WhiteStripe method has a warning about Ravel method? And What is the correct way to use WhiteStripe method?

Machine environment:
Linux Ubuntu 18.04.6
Python 3.9
intensity-normalization 2.2.0

I m looking forward to your rely again!
Best, chl

from intensity-normalization.

jcreinhold avatar jcreinhold commented on June 26, 2024

Hey, thank you for the feedback, it's helpful. MD is a holdover from the original WhiteStripe implementation in R. I've never actually used it, but included it because the original authors did (although they also have FA, and I don't; I probably lost the FA option while refactoring.)

You're correct about how to use the tissue mask to normalize the contrast-enhanced T1-w image.

That warning is just a typo. Please update your version to v2.2.1 (pip install -U "intensity-normalization") to remove it.

Sorry about the nib.load() issue you ran into; I refactored the code in v2.2 from v2.1 to only accept array-like objects (e.g., a numpy array). I didn't get around to updating the tutorials, which I'm assuming you referenced, which caused you to assume they accepted nibabel images. That's my fault. Sorry again.

I updated the tutorials in this latest version, so check them out again (the difference in code is very small, essentially you just need to call .get_fdata() before passing it to the normalization function call).

Again, thank you for the feedback; it's very helpful! Sorry about the misleading documentation; it's just been very busy at work which kept me from getting around to updating it.

Please let me know if you run into any further errors or are confused about any of the documentation.

from intensity-normalization.

Siji-chl avatar Siji-chl commented on June 26, 2024

Thank you! You help me a lot! I have updated the package to v2.2.1. The code runs successfully with numpy array using .get_fdata(). Thank you again!

However, when I used methods (such as KDE or WhiteStripe) which need to be specified modality parameter, it raised error
File "/home/xxx/Documents/py_environments/chl3.9/lib/python3.9/site-packages/intensity_normalization/util/histogram_tools.py", line 125, in get_tissue_mode modality_ = modality.value AttributeError: 'str' object has no attribute 'value'
I found that modality parameter does not accept string anymore (such as 't1') but intensity_normalization.typing.Modality.T1 etc. Maybe it's a BUG or I was wrong about how to use it?

Thank you very much!
Best, chl

from intensity-normalization.

Siji-chl avatar Siji-chl commented on June 26, 2024

By the way, in RAVEL method, create_image_matrix_and_control_voxels funtion requires that all images have the same shape with assert all([shape == image_shape for shape in image_shapes]). Why?

Best, chl

from intensity-normalization.

jcreinhold avatar jcreinhold commented on June 26, 2024

Hi @Siji-chl. Thanks again for the feedback. These are mistakes in the documentation and a bug, respectively 😓. Please update to version v2.2.2 and take a look at the updated documentation/tutorials.

RAVEL requires the images to be co-registered to extract the common "control voxels" (CSF), which is why there is an error, but I (optionally) handle the required registration in the function. (Note that the registration is only required to calculate the control voxels, so the original image shape, orientation, etc. should be returned.)

from intensity-normalization.

jcreinhold avatar jcreinhold commented on June 26, 2024

Please let me know if you run into any further issues. This is good feedback!

from intensity-normalization.

Siji-chl avatar Siji-chl commented on June 26, 2024

Wowwww! Your response is so fast! Thank you a lot!

But... I think there is another BUG in RAVEL method:joy: Look at create_image_matrix_and_control_voxels function, it creates a image_matrix numpy array with shape of (image_size, n_images), and image_size is the number of voxel of the first image in the image list. So, if one of the subsequent images in the list has a larger number of voxel than that of the first image, it runs into error in line 210 image_matrix[:, i - 1] = image_ws.flatten() with ValueError: could not broadcast input array from shape (5242880,) into shape (2801664,). (2801664 is the number of voxel of the first image in my image list, and 5242880 is a subsequent one.)

Best, chl

from intensity-normalization.

jcreinhold avatar jcreinhold commented on June 26, 2024

😭 I was wrong when I said the assert was a bug. I forgot that the images do need to be the same size for the correction step.

In fact the images need to be deformably co-registered to get reliable results; however, empirically, it appears to work fine if the images are rigidly/affine co-registered.

I added an error message instead of the just the assert in v2.2.3! Although I revised ot after I released it, so the most accurate error message (and documentation for the args) is in the master branch and will be released with v2.2.4.

Thanks again!

from intensity-normalization.

Siji-chl avatar Siji-chl commented on June 26, 2024

I m very sorry for the trouble. I mistakenly thought that RAVEL normalizer would do registration for me automatically. It means that I need to register all my images to a template/standard space before I use RAVEL normalization?

Best, chl

from intensity-normalization.

jcreinhold avatar jcreinhold commented on June 26, 2024

You need to at least rigidly or affine co-register the images.

from intensity-normalization.

jcreinhold avatar jcreinhold commented on June 26, 2024

You can use the co-register script or Python class in intensity-normalization FWIW

from intensity-normalization.

jcreinhold avatar jcreinhold commented on June 26, 2024

Deformable registration can be handled by RavelNormalize if the images are rigidly co-registered.

If you're application doesn't require your images to be co-registered at all, RAVEL is probably not the right method for you, and you should use a different normalization method.

If you just want to normalize the images before putting them into a DNN, for example, use something else. RAVEL is overkill.

See the original paper for what it's trying to accomplish.

from intensity-normalization.

jcreinhold avatar jcreinhold commented on June 26, 2024

Closing this since it seems like all your questions are answered. Please open a new issue if you run into a bug. If you have further general questions, please use the discussion tab.

Thanks again for the feedback!

from intensity-normalization.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.