Hi Yuri: 1) Is it possible to change your code so that the normalisation refers to the most represented value instead of the maximum value? 2) Do I understand right, that I first have to apply your code in my script for teaching Premier to read out pixel data, before I can think about using any formulae? Greetings, Svenja
1) My code already uses "most representative value" for normalization. 2) You don't really need to "apply" the code, but write your own macro that does calculations on pixel data extracted by GetArea.
Hello Yuri, I have another question to the histogram width: My output shows now all the grey-scale values between the minimum and maximum grey-value that hit the 5% mark. 1) Is it possible to show only the minimum and maximum value that hit the 5% mark and not all the others therebetween?Thanks a lot again for your help!!
Dear Matt, I worked a lot with you smart ROI App and though it seems to be the perfect tool for my project, there are still a few problems with it: 1)For every new image I want to measure with the App I have to restart Premier completely, because otherwise measured grey-scale values don´t change for a new image. 2)when I change the ROIs width with "+%", the height adapt automatically but the ROIs Area becomes smaller and smaller all in all. 3) I couldn´t work out what the options "0,01%", "1,00%" and "10%" choosable are for. Could you please help me? Thanks a lot, Svenja
Hello Yuri, I have another question to the histogram width: My output shows now all the grey-scale values between the minimum and maximum grey-value that hit the 5% mark. 1) Is it possible to show only the minimum and maximum value that hit the 5% mark and not all the others therebetween?Thanks a lot again for your help!!
Hi Svenja,
The "crossing values" show the values that cross 5% line. On smooth histogram you may get only 2, but on noisy histogram you may get multiple peaks that have more than two 5% crossings. Is it your case? How many values do you have? If not, can you please provide more details - printouts, screenshots...
1)For every new image I want to measure with the App I have to restart
Premier completely, because otherwise measured grey-scale values don´t
change for a new image.
1A) I did not see this behavior but I will try to duplicate it and address the issue. This should not be necessary but try closing and reopening the APP between images (rather than PREMIER) and see if that resolves the issue.
2)when I change the ROIs width with "+%", the
height adapt automatically but the ROIs Area becomes smaller and
smaller all in all.
2A) In my DEVELOPMENT and TESTING, the "+%" (and "-%") were meant to increase (and decrease) the the WIDTH (I think) by the percentage shown in the RADIO BUTTONS (see #3).
3) I couldn´t work out what the options "0,01%", "1,00%" and "10%" choosable are for.
3A) If the WIDTH and HEIGHT of an ROI was 1000pix x 100pix (100000 sq pix), pressing the "+%" set to 10% would increase the WIDTH (I think) by 10% (to 1100pix) and decrease the HEIGHT by the amount needed to maintain the ROI AREA (100000 / 1100 = 90.9).
Doing the same thing with an ROI AREA 1000 x 100 (100000 sq pix) and the option set to 1% would yield an ROI 1010 x 99.
Doing the same thing with an ROI AREA 1000 x 100 (100000 sq pix) and the option set to .1% would yield an ROI 1001 x 100 because the .1 percent change in the HEIGHT would round 99.9 to 100.
Dear Yuri, I have attached two tabs for example. 1) The first tab is the distribution of all grey-scale values referring to the most representative grey-value. It seems that your right with your presumption of noisy images, because every second value is 0. Or could there be another reason for that? Do I need to filter my images? And how could I do that? 2) The second tab shows all the grey-scale values that are crossing or are above the 5% mark referring to the most representative grey-value. Everything below 5% is cut off as being noise. The diagram show the same, but shows on the x-axis only the bins crossing or lieing above the 5% mark. 3) I think that the second tab might be the point to look on: Is it possible to show only the minimum and maximum value crossing the 5% mark, eg. in my example bin 99 and bin 214? Thanks for your ideas! Svenja
Yes, your histogram is stretched, so every other bin is empty, that's the reason of multiple 5% crossings. It can happen when the acquisition system has strong digital gain (>2) that multiplies value of every pixel by 2, so no pixels will have odd values. You may try to fix it on the acquisition side reducing (or switching off) digital gain. If that is not possible, then you can just apply Low-Pass filter to the image (e.g. 3x3) and the histogram should be smooth.
Hi Yuri, thanks for your answer! 1) changing digital gain on my ultrasound device is unfortunately not possible in my study because it is a standard setting. 2) Applying a filter presents me with the problem, that I want to get information of every pixel (raw data)and fear a loss of information by using a filter. 3) Using the second tab with the 5% mark excluding data assumed of being noise could be a solution. The histogram then looks smooth to me. What do you think?
and I believe that you can use it on multiple images without restarting the APP or PREMIER.
I believe what may be missing in your use of this app is the proper use of the GET FROM CURRENT ROI BUTTON in the AREA section and in the CENTER section.
Please see the SCREEN CAPTURES below where the 1st has the info from the CAT IMAGE and the 2nd works with the DOG IMAGE. The APP works with which ever image is ACTIVATED by the USER and used the INFO in the AREA and CENTER sections to set the ROI with the +% and -% buttons.
Hi Matt, thanks for you answer. In your example the ROIs Area is different in the cat (175.420.000 square pixxels)and in the dog (11.220.000 square pixels). I would like to have a ROI of the same area (in your example the one from the cat with 175.420.000 sqpixels) read out of the dog (e.g. also 175.420.000 sq.pixels). In your example you have the same problem as me that cat and dog ( eg the objects of interest) have a different appearance, so a ROI fitting in the cat might have the wrong form to fit in the dog perfectly. So I would like to change the cats ROIs form and maximise the width and simultaniously minimise the height (that should the App do automatically) to read out the dogs information. The area of the ROI (eg 175.420.000 sq.pixels) would be the same in the cat and the dog, but height and width would be adapted to the individual array of the animal. Is this clear to you? Kind regards Svenja
Hi Matt, I tried as you recommended: 1) I created a smart ROI in image 1( H-RE-LAE1) and set everything up with the GET BUTTONS (Area and center)
2) I switched to Image 2 (NHS-RE-LAE) and pressed the SMART ROI BUTTON. The smart ROI appeared as expected.
3) To be on the safe side, I measured the ROIs AREA in Image 1 (H) and in Image 2 (NHS) (have a look at my first screenshot). I have not changed anything on the both ROIs sizes before and as I feared, the AREA of the initial ROI in Image 1 ( 78,998 sq.mm) is larger as the Area of the smart ROI in Image 2 (63,8887 sq.mm).
4) Next I tuned the Smart ROI while pushing the "-" button for the width and the following happened: a) the height got higher (as expected) b) BUT the Area of the smart ROI got smaller and smaller everytime I pushed the "-"button for the width. That is definitively not what the Area should do. See in my second screenshot the #3 in the data collector: The measured AREA of the tuned smart ROI is now only 57,659 sq.mm. Your app curiously shows at the same time a different area for the same ROI of 55,9122 sq.mm.
5) Then I deleted the smart ROI of Image 2 (NHS), opened a new Image (H-RE-LAE-2) and pressed the SMART ROI BUTTON. The smart ROI with the area of 63,8887 square mm appears in the new image as expected.
6) Is it maybe a problem, that the initial ROI is a rectangle and after pressing the Smart ROI Button, the smart ROI always appears as a square? I don´t know if that has any influence..
Let me please know if you have any ideas for that problem. Kind regards, Svenja
Answers
1) Is it possible to change your code so that the normalisation refers to the most represented value instead of the maximum value?
2) Do I understand right, that I first have to apply your code in my script for teaching Premier to read out pixel data, before I can think about using any formulae?
Greetings, Svenja
1) My code already uses "most representative value" for normalization.
2) You don't really need to "apply" the code, but write your own macro that does calculations on pixel data extracted by GetArea.
Yuri
1) Great! So the histogram width will work! Thanks a lot!
2) Such a macro is too complicated for me, because I am no programmer :-(
I have another question to the histogram width:
My output shows now all the grey-scale values between the minimum and maximum grey-value that hit the 5% mark.
1) Is it possible to show only the minimum and maximum value that hit the 5% mark and not all the others therebetween?Thanks a lot again for your help!!
I worked a lot with you smart ROI App and though it seems to be the perfect tool for my project, there are still a few problems with it:
1)For every new image I want to measure with the App I have to restart Premier completely, because otherwise measured grey-scale values don´t change for a new image.
2)when I change the ROIs width with "+%", the height adapt automatically but the ROIs Area becomes smaller and smaller all in all.
3) I couldn´t work out what the options "0,01%", "1,00%" and "10%" choosable are for.
Could you please help me?
Thanks a lot, Svenja
The "crossing values" show the values that cross 5% line. On smooth histogram you may get only 2, but on noisy histogram you may get multiple peaks that have more than two 5% crossings. Is it your case? How many values do you have? If not, can you please provide more details - printouts, screenshots...
Yuri
Svenja --
Thank you for the compliment.
The PROBLEMS you listed and my ANSWERS are below.
My calendar for this week is very busy but I will try to address your PROBLEMS and provide better ANSWERS late today (MON) or late tomorrow (TUE).
If you find the resolution to your PROBLEMS in the ANSWERS below, please let me know.
I hope this information is helpful.
-- Matt
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
1)For every new image I want to measure with the App I have to restart Premier completely, because otherwise measured grey-scale values don´t change for a new image.
1A)
I did not see this behavior but I will try to duplicate it and address the issue. This should not be necessary but try closing and reopening the APP between images (rather than PREMIER) and see if that resolves the issue.
2)when I change the ROIs width with "+%", the height adapt automatically but the ROIs Area becomes smaller and smaller all in all.
2A)
In my DEVELOPMENT and TESTING, the "+%" (and "-%") were meant to increase (and decrease) the the WIDTH (I think) by the percentage shown in the RADIO BUTTONS (see #3).
3) I couldn´t work out what the options "0,01%", "1,00%" and "10%" choosable are for.
3A)
If the WIDTH and HEIGHT of an ROI was 1000pix x 100pix (100000 sq pix), pressing the "+%" set to 10% would increase the WIDTH (I think) by 10% (to 1100pix) and decrease the HEIGHT by the amount needed to maintain the ROI AREA (100000 / 1100 = 90.9).
Doing the same thing with an ROI AREA 1000 x 100 (100000 sq pix) and the option set to 1% would yield an
ROI 1010 x 99.
Doing the same thing with an ROI AREA 1000 x 100 (100000 sq pix) and the option set to .1% would yield an
ROI 1001 x 100 because the .1 percent change in the HEIGHT would round 99.9 to 100.
I have attached two tabs for example.
1) The first tab is the distribution of all grey-scale values referring to the most representative grey-value. It seems that your right with your presumption of noisy images, because every second value is 0. Or could there be another reason for that? Do I need to filter my images? And how could I do that?
2) The second tab shows all the grey-scale values that are crossing or are above the 5% mark referring to the most representative grey-value. Everything below 5% is cut off as being noise. The diagram show the same, but shows on the x-axis only the bins crossing or lieing above the 5% mark.
3) I think that the second tab might be the point to look on: Is it possible to show only the minimum and maximum value crossing the 5% mark, eg. in my example bin 99 and bin 214?
Thanks for your ideas!
Svenja
Yes, your histogram is stretched, so every other bin is empty, that's the reason of multiple 5% crossings. It can happen when the acquisition system has strong digital gain (>2) that multiplies value of every pixel by 2, so no pixels will have odd values. You may try to fix it on the acquisition side reducing (or switching off) digital gain. If that is not possible, then you can just apply Low-Pass filter to the image (e.g. 3x3) and the histogram should be smooth.
Yuri
thanks for your answer!
1) changing digital gain on my ultrasound device is unfortunately not possible in my study because it is a standard setting.
2) Applying a filter presents me with the problem, that I want to get information of every pixel (raw data)and fear a loss of information by using a filter.
3) Using the second tab with the 5% mark excluding data assumed of being noise could be a solution. The histogram then looks smooth to me.
What do you think?
thanks a lot!
Svenja
Low pass filter smooths the image (and histogram), check this link (look for Box blur)
https://en.wikipedia.org/wiki/Kernel_(image_processing)
If you get smooth histogram, as in question 3, then you can use it without filter.
Yuri
Svenja --
I have tested the
Smart Roi Project V1A
and I believe that you can use it on multiple images without restarting the APP or PREMIER.
I believe what may be missing in your use of this app is the proper use of the GET FROM CURRENT ROI BUTTON in the AREA section and in the CENTER section.
Please see the SCREEN CAPTURES below where the 1st has the info from the CAT IMAGE and the 2nd works with the DOG IMAGE. The APP works with which ever image is ACTIVATED by the USER and used the INFO in the AREA and CENTER sections to set the ROI with the +% and -% buttons.
I hope this information is helpful.
-- Matt
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
thanks for you answer.
In your example the ROIs Area is different in the cat (175.420.000 square pixxels)and in the dog (11.220.000 square pixels). I would like to have a ROI of the same area (in your example the one from the cat with 175.420.000 sqpixels) read out of the dog (e.g. also 175.420.000 sq.pixels).
In your example you have the same problem as me that cat and dog ( eg the objects of interest) have a different appearance, so a ROI fitting in the cat might have the wrong form to fit in the dog perfectly.
So I would like to change the cats ROIs form and maximise the width and simultaniously minimise the height (that should the App do automatically) to read out the dogs information. The area of the ROI (eg 175.420.000 sq.pixels) would be the same in the cat and the dog, but height and width would be adapted to the individual array of the animal.
Is this clear to you?
Kind regards Svenja
I tried as you recommended:
1) I created a smart ROI in image 1( H-RE-LAE1) and set everything up with the GET BUTTONS (Area and center)
2) I switched to Image 2 (NHS-RE-LAE) and pressed the SMART ROI BUTTON. The smart ROI appeared as expected.
3) To be on the safe side, I measured the ROIs AREA in Image 1 (H) and in Image 2 (NHS) (have a look at my first screenshot). I have not changed anything on the both ROIs sizes before and as I feared, the AREA of the initial ROI in Image 1 ( 78,998 sq.mm) is larger as the Area of the smart ROI in Image 2 (63,8887 sq.mm).
4) Next I tuned the Smart ROI while pushing the "-" button for the width and the following happened:
a) the height got higher (as expected)
b) BUT the Area of the smart ROI got smaller and smaller everytime I pushed the "-"button for the width. That is definitively not what the Area should do. See in my second screenshot the #3 in the data collector: The measured AREA of the tuned smart ROI is now only 57,659 sq.mm. Your app curiously shows at the same time a different area for the same ROI of 55,9122 sq.mm.
5) Then I deleted the smart ROI of Image 2 (NHS), opened a new Image (H-RE-LAE-2) and pressed the SMART ROI BUTTON.
The smart ROI with the area of 63,8887 square mm appears in the new image as expected.
6) Is it maybe a problem, that the initial ROI is a rectangle and after pressing the Smart ROI Button, the smart ROI always appears as a square? I don´t know if that has any influence..
Let me please know if you have any ideas for that problem.
Kind regards, Svenja
Svenja --
I read your message and then did a test.
Here are the results.
Please remember that if your ROI is small enough that the % CHANGE that you have requested is less than 1 pixel, the WIDTH or HEIGHT cannot change.
Also please note that the % functions work as they do so that a
+% and then a -%
or a
-% and then a +%
result in a return to the original number.
Please let me know if you need further clarification.
I hope this information is helpful.
-- Matt
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Created two images (BLACK and WHITE) that are the same dimensions (1000x1000pix).
Created 1 ROI in the BLACK IMAGE at 250, 250 (ULC) with 250 x 250 dimensions via ROI BY THE NUMBERS TOOL.
Press SET SMART ROI AREA GET FROM CURRENT ROI BUTTON
Results =
Area = 63,001 (sqrt 63,001 = 251)
Pressed 10% OPTION and then +% WIDTH BUTTON
Results =
Width = 251/.90 = 278.888
Area = 62775 (99.64% of 63001)
Activated WHITE IMAGE and pressed CREATE SMART ROI BUTTON
Results =
Width = 279
Area = 62775
Pressed +% WIDTH with 10% OPTION
Results =
Width = 310 (279/.90)
Area = 63550 (100.87% of 63001)