Adding Feature
Hello
I've written a macro which adds a feature to an image, however when I run the macro it doesn't add the feature but when I run it in debug mode I can get it to add the feature if I click on the image immediately after it was supposed to do the addition. The cursor is green with a small R next to it. As soon as click the feature appears and the rest of the macro works OK. Is it a bug or have a missed something. Code is below
With Application.DocumentCommands.Active(Nothing) .Run(doc1) End With With Select.FeaturesManagerCommands.Apply(Nothing) .Collection = 1
.Feature = 0 .Item = 0 ' .Run(ThisApplication.ActiveImage) .Run(doc1) End With
Any help appreciated
Regards
David
0
Best Answer
-
David,I checked your macro. It's quite a macro!The problem with displaying ROI from features manager looks like a display problem, what Nikita mentioned earlier. Hopefully it will be fixed by new patch.As a workaround you can add the following command, after Apply command, line 530, which makes ROI visible:
With Select.Roi.ToolsCommands.Select(Nothing) .Overlay = Overlays.OverlayType.ROIOverlay .Run(doc1) End With
Regards,Yuri0
Answers
Hi David,
It is look like the refresh display issue (recently added feature is not visible). Could you please attach the Features Manager file?
Thank you,
Hello Nikita
I'm getting an error Uploaded file type not allowed. I have a server I can put it on but you'll need to contact me off the forum as I don't want to put its address in the public domain.
Regards
David
zip file worked
Regards
David
Dave,
The ONLY change I made to be able to run your code successfully is I added the line:
Dim doc1
Right above your first line of code (the first 'With' block).
Other than that, your code is pulling the feature from the SECOND feature collection, so you have to be sure you have that.
Hello Vern
I declare doc1 in the first line of the function I've put the whole function into a text file which should hopefully be attached. The idea is that I first select DAPI labelled nuclei from 1 image and apply the regions from each nucleus onto another image which has a single spot somewhere in the nucleus. I then divide each region into 5 roughly equal area regions and see which one the spot is in. The whole macro works well except that I have to stop it to click on the image so that it recognises the features. It seems like its stuck in measurements mode
Regards
David
Hello Yuri
Didn't work so measurement mode mustn't be the problem
Regards
David
Hello Yuri
I've put all the files in the attached zip file. The test.txt file isn't included as its just an empty text file for outputting the data to. The macro works fine the only problem is in the MeasureRings function at the point where it applies the saved rings (features) to the image. It just doesn't do it unless you put a break point in and actively click the image then restart the macro then its fine. I've put some test images in the usual server in a directory called features.
Regards
David
Hello Yuri
Should be attached
Regards
David
Hello Yuri
That works, now on to the 3D version, so will no doubt be in touch
Regards
David