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
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,0 -
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
0 -
Also you can try to zip or change extension. If this is not working, you can send me the link in the private message.0
-
-
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.
0 -
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
0 -
David,If the macro is in measurement mode, which you don't need, you can switch it off using the following command:
With Measure.Measurements.ToolsCommands.Select(Nothing) .Tool = eMMTool.NoTool .Run(ThisApplication.ActiveImage) End With
Regards,Yuri0 -
Hello Yuri
Didn't work so measurement mode mustn't be the problem
Regards
David
0 -
David,Is the problem that the feature cannot be added to the image from features manager?I checked your text file, but it's difficult to see something, because many functions and subs are not defined, external files missing.Can you please post/send your project, IPX file? (use the Package menu item in the scripting workbench). And explain what steps to perform to reproduce the problem? You can also add all additional files, such as IQO to the IPX file (using Additional files in the project settings, the location of these files must be in one of the Premier known folders, for example Configuration Files). Otherwise these files have to be sent separately.Thanks,Yuri0
-
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
0 -
David,There is no VB file in the ZIP. Can you please package the project to IPX file? It will ensure that all necessary files are included.Thanks,Yuri0
-
-
Hello Yuri
That works, now on to the 3D version, so will no doubt be in touch
Regards
David
0
Categories
- All Categories
- 961 Image-Pro v9 and higher
- 9 Image-Pro FAQs
- 18 Image-Pro Download & Install
- 448 Image-Pro General Discussions
- 486 Image-Pro Automation (Macros, Apps, Reports)
- 20 AutoQuant Deconvolution
- 2 AutoQuant Download & Install
- 18 AutoQuant General Discussions
- 195 Image-Pro Plus v7 and lower
- 3 Image-Pro Plus Download & Install
- 106 Image-Pro Plus General Discussions
- 86 Image-Pro Plus Automation with Macros
- 19 Legacy Products
- 16 Image-Pro Premier 3D General Discussions
- 26 Image-Pro Insight General Discussions