ROIs in Digital Micrograph EELSspectra behave strangely after command "EELSSubtractPowerlawBackground()" - Bug? (GMS 2.3) - background

When I run the script below on a DM EELS spectrum that already contains background and signal ROIs, it is ok if I don't show any images.
ImageDocument imdoc = GetFrontImageDocument()
image i0 = ImageDocumentGetImage(imdoc,0)
image subt = eelssubtractpowerlawbackground(i0,800,900)
//image irrelevant = realimage("irrelevant",4,100,100)
//showimage(irrelevant)
But if I show any image after running the background subtraction command (activate the last 2 lines for example) the pre-existing ROIs on the initial image are changed (sig disappears and bckgd is moved to the new position).
This is despite i0 being in theory a new image, not part of the initial one.
Creating copies within the script and working on them appears in any case not to solve the problem.
More surprising is that if I first make a duplicate of the initial image and run the script on that, then close the new windows and the (modified) spectrum on which the script was run, then try and duplicate the initial image, the duplicate has the modified ROIs rather than its own. A second duplicate seems to be ok. I have no idea what's going on. Grateful for any ideas.
(The problem was initially part of a much bigger script in which I need to show images, I've reduced it to the essentials here). I'm using v2.3.2.

I have tested your script on an EELS Spectrum with ROIs in GMS 2.3.3 and in GMS 3.2.2
GMS 2.3.3:
It does not seem to happen due to the ShowImage() but rather whenever the display of the image the last Background/Signal ROI was used on is refreshing its display. You get the same behavior when you run your script without the last two lines, but then click on another image (to select it) and then the spectrum again. And you get the same if you've used the background-subtraction ROI on a completely different image and then run the script. It messes up that last images' ROIs.
GMS 3.2.2: Doesn't show this. All is fine regardless what you do.
So, from these two tests I would conclude it is a bug in GMS 2.3 which has since been fixed.
The behaviour is indeed very odd, and I see nothing wrong with your code.
The bug seems to be that the command eelssubtractpowerlawbackground() messes with the settings of the last active signal-extracting ROIs, regardless on where they are placed on. It doesn't matter what the input image is. It seems to "reuse" these last ROIs.
Unfortunately, I don't know a good workaround for it.

Related

VBA PPT AddEffects to Pictures Inconsistently Applies Effects

I am getting really frustrated. I have code that works, as in it literally does what it says it will do, however, it doesn't always correctly read my images on the slides as images. I even went so far as naming them all "Picture" and using it as a variable. It actually worked for a second but then 5 pictures in it stopped working again.
This is the code and it DOES work:
With shp.Fill.PictureEffects
Dim eff As PictureEffect
Set eff = .Insert(msoEffectSharpenSoften)
eff.EffectParameters(1).Value = 1
End With
Why will this block of code not work on all of my images? Even when it throws the error it WILL sharpen the image as intended, but then stop??? I do not understand the problem or what a possible fix might be. This is literally the last bit of my work process that I need to solve...
For the record, I have code that will adjust the Height, Width, and center the image perfectly on the slide with no issues whatsoever, code that will put images in a placeholder and then format text... but for some reason THIS block of code won't work...
I have also tried deleting the image, manually reuploading it using the Insert Picture function in the program and it still doesn't work??? Is it possible this has something to do with the fact I am using PowerPoint 2013?
I tested it a different way by changing the picture format, it seemed like it was working but it didn't. Whether I automate it, whether I insert picture, no matter what I do, whether it's in a pre positioned container or not, this line of code refuses to work. Why are my images, in both PNG and JPEG format not being accepted by PowerPoint VBA?

What parameter in Cytoscape determines the stacking order of edge rendering?

I have created a cytoscape network with a number of crossing and re-crossing edges. It is meant to do this, and I don't wish to reduce the amount of crossing that is occurring.
I would, however, like to be able to determine which edges are on "top" and which are in "back" - in the same way that you would "bring to front" or "send to back" in Powerpoint or Photoshop or any of numerous display programs.
Which style parameter or similar value is used to determine rendering order of edges? Note that I am referring to the edge line itself, and not some annotation.
Thanks much.
Unfortunately, that isn't available in the current release, but Cytoscape 3.9 will include that feature. If you want to try a copy of 3.9 (which isn't nearly ready for production release), you can download it at: https://cytoscape-builds.ucsd.edu/cytoscape-builds/Cytoscape-3.9.0/
-- scooter

Photoshop jsx image grid

What I am ultimately trying to do is to create a grid of images for print that are minor variations of the same thing (different text is all). Looking through online resources I was able to create a script that changes the text and exports all of the images necessary (several hundred). What I am trying to do now is to import all of these images into a new photoshop document and lay them all out in a grid and I can't seem to find any examples of this.
Can anyone point me in the right direction to place a file at a specific coordinate (I'm using CS5 and have the design suite so if there is a way in illustrator to do this quickly...)?
Also, I'm open to other ideas on how to do this (even other programs) easily. It's for labels so the positioning on the sheet has to be pretty precise...
The art layer object has a translate() method that takes delta x and y params. You'll need to open each image, copy it to the target document, get its current location (using artLayer.bounds) and do the math to find the deltas to position it where you want it. Your deltas can be in pixels so you'll get plenty of precision.
Check out your 'JavaScript Scripting Reference' pdf in your Adobe install directory for more details.
Ok I'm marking Anna's response as the answer because though I didn't fully test it, it seems like it should work and answers the original question with jsx. However I'm also leaving my final solution in case anyone else runs across this with the same issue and may prefer this method as well.
What I ended up doing instead is using InDesign. I figured out that it has a grid option that lets you import a number of files and place them all in an equal grid in a single command. This is almost exactly what I was looking for, except that it leaves a small border/margin in between the columns and grids and mine were designed to meet exactly.
I couldn't figure out how to make it not have the border (I have very little experience with InDesign, it may be possible). However I was able to select all my images and scale them uniformly to be the correct size, then I just selected each column and dragged it over to snap to the adjacent column and the same with rows...

ABCPDF.NET not rendering image

I am using ABCPDF.net to generate my PDFs from HTML files. There are 3 images on the HTML page which; of which 2 images are generated but the third is one is not on the PDF. I have tried to move the logo around but without any luck. This is my first time using this product which I am impressed with but this one problem is throwing me off.
From memory there could be one or two things causing this.
1) If your image happens to cross over the boundary of the page even by 1 pixel it will not be rendered.
2) You have to make sure that all of your elements are loaded in a procedural fashion by which I mean that whatever you want to be displayed on the top must be added to the page last. If you don't do this you may find that a rectangle you declared to contain some text for example will be displayed over the top of your image which will obscure it.
3) Sounds daft but just double check all syntax and the images location and ensure that you have referenced it correctly.
If all else fails could you provide some source code or a more in depth explanation.
EDIT: Also double check that you have set the correct size on the image when importing it as you may find it reverts back to the actual dimensions that it is on the disk which could make it too big for the page thus not rendering it.

VB.NET Graphical overlay not lined up between computers

I've got a WinForms application that brings in an image into a picturebox and I allow the user to click on the control to add a "stamp" at that point on the image. When the user is finished, each "stamp" location is stored in an XML for use elsewhere in the application where the stamps are redrawn (as to not alter the original image) in the locations specified beforehand.
Now, my problem is that these locations are in terms of pixels and originally I noticed that certain computers would display the redrawn "stamps" differently than the original computer. I did a little research and found that the DPI settings could help solve this issue. So, I've tried adding code to offset this issue, but it doesn't appear to be working correctly. Here are my steps:
When the form initializes, I grab the current computer's DPI using Me.CreateGraphics().DpiX and Me.CreateGraphics().DpiY. I also grab the original computer's graphics stored in the XML file
For each "stamp" stored in the XML file, I set the desired location in a Point variable by using a similar calculation as this:
New Point(Stamp.X * (dpiX / dpoX), Stamp.Y * (dpiY / dpoY)) where dpi? is the current computer and dpo? is the original computer
Am I going at this the right way, or is there an easier way to tackle this problem?