Automatic Detection of Scale Bar/Insert New Scale Bar

Two quick questions.  I have never scripted much, but I have an idea which would help my workflow professionally. 
The first questions is whether there are any professional services which I might be able to contract in order to have a script developed? 
The second question is in regards to whether my scripting idea would even be possible in Photoshop. 
I do research using electron microscopes, and as such in every micrograph I collect there is a scale bar.  Unfortunately, the scale bars are not aesthetically pleasing, and so I bring them into Photoshop.  Typically I will rescale, cut, paste, etc to use the images to tell the story about the data.  One of the things I always do is draw a line trace over the scale bar on the image (typically with my own font and applied stroke) and then adjust it (whether I want to double the scale, etc) to make it look more professional.  On all of my micrographs there is a black information bar with white lettering and a white scale bar (see attached).  Is there any way to write a script that would automatically read the region where the scale bar is located and then draw a new layer with a line the same size (with the line properties desired) using a Fourier transform or some other mathematical algorithm?  If that is possible, the next step would be to read the scale bar size and do a similar function with inserted text.
Thanks,
Matt

If the bar only varies in width, this might help to create a layer of the size of the bar:
// 2011; use it at your own risk;
#target photoshop
if (app.documents.length > 0) {
var myDocument = app.activeDocument;
// set to pixels;
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
myDocument.selection.load(myDocument.channels[0], SelectionType.REPLACE);
myDocument.selection.select([[0,960], [975,960], [975,992], [0,990]], SelectionType.INTERSECT, 0, false);
myDocument.selection.makeWorkPath(1);
var theBar = solidColorLayer(128,128,128);
theBar.name = "scalebar";
// reset;
app.preferences.rulerUnits = originalRulerUnits;
////// function to create a solid color layer //////
function solidColorLayer (theRed, theGreen, theBlue) {
// =======================================================
var idMk = charIDToTypeID( "Mk  " );
    var desc3 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref1 = new ActionReference();
        var idcontentLayer = stringIDToTypeID( "contentLayer" );
        ref1.putClass( idcontentLayer );
    desc3.putReference( idnull, ref1 );
    var idUsng = charIDToTypeID( "Usng" );
        var desc4 = new ActionDescriptor();
        var idType = charIDToTypeID( "Type" );
            var desc5 = new ActionDescriptor();
            var idClr = charIDToTypeID( "Clr " );
                var desc6 = new ActionDescriptor();
                var idRd = charIDToTypeID( "Rd  " );
                desc6.putDouble( idRd, theRed );
                var idGrn = charIDToTypeID( "Grn " );
                desc6.putDouble( idGrn,theGreen );
                var idBl = charIDToTypeID( "Bl  " );
                desc6.putDouble( idBl, theBlue );
            var idRGBC = charIDToTypeID( "RGBC" );
            desc5.putObject( idClr, idRGBC, desc6 );
        var idsolidColorLayer = stringIDToTypeID( "solidColorLayer" );
        desc4.putObject( idType, idsolidColorLayer, desc5 );
    var idcontentLayer = stringIDToTypeID( "contentLayer" );
    desc3.putObject( idUsng, idcontentLayer, desc4 );
executeAction( idMk, desc3, DialogModes.NO );
return app.activeDocument.activeLayer

Similar Messages

  • Hi. I am using the iPhone 4S and when I'm searching for places using Google it does not automatically detect my location. How do I change this? FYI...under settings i have it set at "Use new precise locations from my device."

    Hi. I am using the iPhone 4S and when I'm searching for places using Google it does not automatically detect my location. How do I change this? FYI...under settings i have it set at "Use new precise locations from my device."

    If you are missing using google maps - try the Nokia map app called "here"

  • Automatically insert new master pages

    I'm trying to insert new master pages automatically in indesign cs5.5. I have a two page side by side masters. Anyone know how I can do this?

    Precise Formwork wrote:
    Thanks I have that selected. All that happens is red + to link to another page. I then have to manually drag more masters and link by hand again. Am I missing something here? This is just the same as old version.
    I've found Smart Text Reflow useful for working like a word-processor, but it's tricky to set it up right and to stay alert to not inadvertantly changing settings that can create confusing behavior. Once you establish a stable workflow for your needs, it will repay the learning effort.
         Search Google for terms like "InDesign tutorial smart text reflow" without quotes for useful links.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices    

  • Is it possible to have the Navigation Toolbar (or at least the pop-up Location Bar) show automatically when I open a (blank) new tab and be automatically hidden once I select an address/search?

    I'm obviously aware of the possibility to show/hide the Navitation Toolbar manually, but I'd like to have it done automatically to get the best of screen space and navigation ease.

    Thanks cor-el! I had tried that out, but was turned off by the different workflow (can't click Tab to select the address suggestions) and assumed by the look that I couldn't use my Smart Keywords for searches.
    In fact, the workflow isn't that much bulkier and the Location Bar is fully functional:
    * ''for a search: Ctrl+L, (Smart Keyword +) [search terms], Enter''
    * ''for a suggested address: Ctrl+L, Down, Enter, Enter''
    Still, it would be nice in future versions if:
    # the Location Bar could automatically open when opening a (blank) new tab (just as the cursor automatically goes to the Location Bar when a new tab is opened with the Navigation Toolbar showing) to avoid the Ctrl+L step of the workflow
    # the Tab, Enter workflow could be enabled for selecting address suggestions in the pop-up Location Bar
    Or (most simply in my mind):
    if '''the Navigation Toolbar could be set to show when a (blank) new tab is opened and disappear once an address/search is selected'''.

  • Can you automatically delete anchor points when a new image is placed on top - so that it 'replaces'

    Hi all,
    I know that I can delete anchor points but I was wondering if there is a shortcut to do it on a larger scale.
    Can you automatically delete anchor points when a new image is placed on top - so that it 'replaces' the image, only on the parts obviously that you cover with the new one.
    Thank you all

    Hi,
    I'm using CS6, and I have a tree vector image, and I am trying to put names on top, but when I do this to keep it clean with no anchor points (as my other software cant read it with all the points in it) I have to manually delete each one but it deletes the whole path and I then end up with a tree, names on top, and a big gappy circle around the names.
    So really, I wanted to add the names on top, and have that delete all anchors underneath .
    Does this make sense? :S

  • How to insert  new records in Master and detail Forms.

    Hi,
    I am having trouble inserting values in both master and detail view at the same time. The scenarios is I have a Dept Table (View Object-VO1) and Employee Table(View Object -VO2) both linked with a foreign key, as per Default HR schema in Oracle DB XE.
    Now I want to insert new record in both Dept(VO1) and EMP(VO2) table via a New page say ( Page2 ). There is a button on Page1 with button INSERT .I can only drag-drop "CreateInsert" operation on that button for VO1 or VO2. So only text box for Dept records are enable to insert data but not Emp records. Is there a way I can insert data in both the tables at the sametime??
    Thanks,
    MB

    Hi MuradRabbani,
    You can programmatically call both createInsert Operations,
    Add to your pageDef both CreateInsert Operations.
    Create a button tha will call insert method from Master (VO1) and then call insert method for Detail (VO2)
    Here is an Example code of calling the operations:
    DCBindingContainer dcb = ADFUtils.getDCBindingContainer(); //you need ADFUtils.java and JSFUtils.java classes. You can find them in the sample applications in your JDeveloper.
    OperationBinding oper = dcb.getOperationBinding("CreateInsertVO1");
    oper.execute();
    -----------------NOTE: at this point you should have set values that compine the ViewLink on the master in order the detail will know where to link the new record there are many ways to do it.
    As an approach try to overrdi the create Method on the in the ViewRowImpl of your Master vo (VO1)
    e.g.
    @Override
    protected void create(AttributeList attributeList) {
    //before
    attributeList.setAttribute("NameOfAttribute", valueHere);
    super.create(attributeList);
    After that you should call the operation for your detail VO2
    e.g.
    DCBindingContainer dcb = ADFUtils.getDCBindingContainer();
    OperationBinding oper = dcb.getOperationBinding("CreateInsertVO2");
    oper.execute();
    The detail record will now have the values from your master automatically.
    Regards,
    Dimitris.

  • How to insert new line character?

    Hi all,
    I have two lines to print.
    out.println("Available number of columns="+cols);
    out.println("Number of columns must be present=10");My problem is:
    i want both the lines to be printed one below the other. But, it is displayed in one single line.....
    Can anyone please tell me how to insert new line character?
    I tried with \n, '\n' and \r\n but, in vain......
    Thanks for your time.
    Regards,
    Ashvini

    You should never use "\n" directly.
    The line separator character is different on different operating systems.
    And putting quotes around it in your string will make absolutely no difference in the JSP.
    To find out what the line separator is you should use System.getProperty("line.separator");
    The JSPWriter and PrintWriter classes will automatically use this property with a println statement, so a println will always finish with a line separator.
    The issue here was that HTML by default ignores all whitespace.
    The solutions provided
    - use a <br> tag instead of a carriage return
    - use <pre> tags, which tells the browser not to ignore whitespace. That can be troublesome in JSP which generates a lot of extraneous carriage returns into the code.
    Cheers,
    evnafets

  • Auto Increment ID Field Table in the Oracle Database (insert new record)

    I have been using the MySQL. And the ID field of the database table is AUTO INCREMENT. When I insert a new record into a database table, I can have a statement like:
       public void createThread( String receiver, String sender, String title,
                                 String lastPostMemberName, String threadTopic,
                                 String threadBody, Timestamp threadCreationDate,
                                 Timestamp threadLastPostDate, int threadType,
                                 int threadOption, int threadStatus, int threadViewCount,
                                 int threadReplyCount, int threadDuration )
                                 throws MessageDAOSysExceptionand I do not have to put the ID variable in the above method. The table will give the new record an ID number that is equivalent to the ID number of the last record plus one automatically.
    Now, I am inserting a new record into an Oracle database table. I am told that I cannot do what I am used to doing with the MySQL database.
    How do I revise the createThread method while I have no idea about what the next sequence number shall be?

    I am still very confused; in particular, the Java part. Let me try again.
    // This part is for the database table creation
    -- Component primary key sequence
    CREATE SEQUENCE dhsinfo_page_content_seq
        START WITH 0;
    -- Trigger for updating the Component primary key
    CREATE OR REPLACE TRIGGER DHSInfoPageContent_INSERT_TRIGGER
        BEFORE INSERT ON DHSInfoPageContent //DHSInfoPageContent is the table name
        FOR EACH ROW WHEN (new.ID IS NULL) // ID is the column name for auto increment
        BEGIN
            SELECT dhsinfo_page_content_seq.Nextval
            INTO :ID
            FROM DUAL;
        END;/I am uncertain what to do with my Java code. (I have been working with the MySQL. Changing to the Oracle makes me very confused.
       public void updateContent( int groupID, String pageName, int componentID,
                                  String content, Timestamp contentCreationDate )
                                   throws contentDAOSysException
       // The above Java statement does not have a value to insert into the ID column
       // in the DHSInfoPageContent table
          Connection conn = null;
          PreparedStatement stmt = null;
          // what to do with the INSERT INTO below.  Note the paramether ID.
          String insertSQL = "INSERT INTO DHSInfoPageContent( ID, GroupID, Name, ComponentID, Content, CreationDate ) VALUES (?, ?, ?, ?, ?, ?)";
          try
             conn = DBConnection.getDBConnection();
             stmt = conn.prepareStatement( insertSQL );
             stmt.setInt( 1, id ); // Is this Java statement redundant?
             stmt.setInt( 2, groupID );
             stmt.setString( 3, pageName );
             stmt.setInt( 4, componentID );
             stmt.setString( 5, content );
             stmt.setTimestamp( 6, contentCreationDate );
             stmt.executeUpdate();
           catch
           finally

  • Settings for update/insert new records

    Hi everybody,
    I'm at the beggining of learning the OWB in order to create a Data Warehouse environment.
    I have successfully created a table in the target schema , which is a match of columns found in 4 tables in the source schema.
    Which settings(steps) are necessary in order to update some records according to the update done in 4 tables in source schema , which have already been inserted in the table in target schema- using the execute pop-up menu command?
    Additionally , how can I insert only the new records to the target schema by using the execute command in pop-up menu ...
    Thanks , a lot
    Simon

    Hi Simon,
    If you have constraints set on your target table, and the operator properties are set to "Match by Constraints = All Constraints", then the process recognizes automatically when to update which fields and when to insert new records.
    If you have no constraints on your target then the operator properties are set to"Match by Constraints = No Constraints", and in this case you should set the Loading properties for each attribute (Field) in the target table.
    Greetings,
    Ilona Tielke

  • Min and Max and insert new rows

    Hello,
    I am really a beginner in Excel (2007). I am not sure if this is the correct forum, anyway.
    I have grouped some rows in a sheet (rows 1, 2 and 3, columns A and B, table below), some of the columns have numeric values in that group and I have a row (inside that group) that shows the maximum and minimum values (row 1):
              A     B 
    +  1   43   12 <- MAX and MIN values for row 2 and 3 columns A and B
    +  2   34   12
    +  3   43   34
    I am using MAX and MIN functions: A1 = MAX($A2:$A$3), B1 = MIN($B$2:$B$3)
    The problem comes when I want to insert more rows after row 3, the formula keeps wrapping to A$2:$A$3 therefore I need to readjust the formula to: MAX($A2:$A$4) manually (for MIN is the same).
              A     B 
    +  1   43   12 <- Are the same, they should be
    "98 and  10"
    +  2   34   12
    +  3   43   34
    +  4   98   10 <- New row, but the maximum and minimum continues to be the same, I want to extend the formula automatically to the 4 row when I insert the new row.
    Question:
    How can I extend the function of the MAX and MIN formula automatically when I insert new rows?
    Please consider that I may insert rows at the beginning, in the middle or the end.
    Thanks,
    Enrique.
    Kikeman Electric Systems Engineer

    Hi Enrique,
    Thanks for posting in MSDN.
    Based on the description, you want to modify the formula for the A1 and B1 cell when you insert a new rows.
    Yes, we can use Worksheet.Change to dermin the change of data on the worksheet then we can modify the formula as we wanted. Here is a sample for your reference:
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Me.Range("A1").Formula = "=MAX($A2:$A" & Me.UsedRange.Rows.Count & ")"
    Me.Range("B1").Formula = "=MIN($B2:$B" & Me.UsedRange.Rows.Count & ")"
    End Sub
    You can more detail about Excel VBA developing from link below:
    Getting Started with VBA in Excel 2010
    Welcome to the Excel 2013 developer reference
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Mail does not retain correct external server path for Exchange Server '07 even when "automatically detect and maintain account settings" is unchecked. Advice?

    Mail keeps resetting the external server path for an Exchange server '07 account when the program is closed and reopened. This happens even though "automatically detect and maintain account settings" is unchecked. To reset to the correct setting I need to disable the account, make the change and save with the account disabled, close Mail, reopen Mail, and enable the account. Then the settings are maintained and Mail works great... until Mail is closed and reopened again. At that point the server path reverts to an incorrect setting. Anyone else experiencing this? Advice? I don't think this is a problem with the Exchange server because this problem did not happen with OS X Mavericks.

    This this to fix repeated password requests....
    Open Keychain Access in Applications/Utilities
    Search for your Dreamhost accounts. There should be two entries (incoming, outgoing) for each account.
    It's not uncommon to find old entries. You might want to delete all and start clean.The Keychain isn't smart and will keep all old entries when you add/change a password.
    While you are in the Keychain run Keychain First Aid, Under Keychain Access in the Menu bar.
    Open Mail
    Open Connection Doctor.
    If you see red for the account, enter the password again.
    If you continue to have problems, delete the account then add it back.

  • Cut automatically detected scenes?

    hello Im new in final and i need to know how can i cut automatically detected scenes? after click on dv start/stop detect. or is only manual?
    thanks

    Once you SUB-CLIP after using Start/Stop Detect, you can treat the sub clips as though they are individual video elements. However, they are not.
    If you want individual files and are working in DV, you have two options.
    1. log each clip individually then batch capture within FCP
    2. use a utility like Live Capture Plus (when capturing) or CatDV (after capture) to cut the longer capture file into individual clip files. Both LCP and CatDV are from Squarebox software.
    x

  • Option + arrow keys suddenly inserts new columns

    This happens frequently when I work in Numbers.
    When I shall edit text in a cell, option + > and option + < all of a sudden cease to work. Instead of jumping to next or previous word, a new column is inserted.
    I don't know what causes it. I haven't found another solution than closing the document and reopen it.
    Fred

    I always edit text directly in cells and option + arrow keys normally jump to next or previous word.
    Yes they are greyed out for me too.
    I just noticed that if I by mistake press Cmd + return (instead of option + return) when I want to edit, it causes option + arrow keys to insert new columns. I can revert to normal by placing the cursor in the formula bar and using option + arrows. After that option + arrow keys jump to next or previous word also when I edit directly in cells.
    Thanks for telling about using the formula bar. Now I don't have to close and reopen the document.

  • Automatically detect a Printer plugged to a serial port?

    Hello, is there a way for me to automatically detect with java if a printer is plugged in to a serial port (and if so, which one) on my computer.
    I am using javax.comm, but there is no such feature in there.
    Thanks in advance.

    I am not very familiar with this area but I am 99% sure you wouldn't get a signal to tell you are printer had been plugged in to a serial port.
    Your best bet is to spawn a new thread that polls the serial port looking for a new printer.
    Not very pretty I admit but it shouldn't be to hard to do.

  • Automatically detect the caller class!

    Guys,
    I have a simple but "sounds-like-general-and-interesting" doubt..
    I have a class 'A' and another class 'B'. I have a method in 'A' called 'a' calling a method in class 'B' (which is 'b').
    suppose the control is inside the method 'b' of the class 'B'.
    Now, the doubt is
    how can I find out that it was class 'A' who called the method 'b' of class 'B' from within the method 'b'?
    the scenario is a simpe loging scenario where the class 'B' is a Logger class and I want to automatically detect the class calling this component from within this component so that it can be logged too.
    Hope my problem is clear. Thankx in advance for the replies.. am stuck and confused too.. and hop there's a solution for this
    regards
    Manesh

    mgumbs is right - typically a Logger class will accept a context (Object) to indicate where the message has come from. Sometimes people pass in "this", sometimes they pass in "this.class" or sometimes they'll log on behalf of another class. It's pretty much the same solution - if it's needed you should supply it.
    One method made possible in J2SDK-1.4 is using a stack trace to find out what the calling class/method is. Perhaps the only way to do that would be to throw a new Exception and get hold of its stack trace elements. I suspect that this would add significant overhead, though, and I certainly wouldn't recommend it!

Maybe you are looking for

  • Can CS3 upgrade be used for 6.5?

    Hi i'm currently using AE 6.5 pro(mac) and wondering if i can buy the CS3 upgrade version for it? I went down to the software store recently and the sales guy said i would need the full retail version because the CS3 upgrade needs at least AE7 instal

  • ITunes showing broken chain link image instead of feed or iTunes tag image.

    URL for Podcast page in iTunes: http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=328268718 URL for Feedburner feed that iTunes is pointing to: http://feeds.feedburner.com/vntruecast URL for original feed that Feedburner is pointing to

  • Bug report: adding to contacts of received phone number or text

    Have highlighted selected phone number from caller log. Press hold on number to get side icons to show up on the right side of the screen. Selected add to contact icon. Gives me select screen of contacts. ??? Is this a bug or am I doing something wro

  • Class not found, Jar not executing

    Hello, I created a JAR file and cannot execute it by running java -jar myjarfile.jar. I get no error message and it does not execute. If I extract the JAR, and run my main class with java packagename.myclass it works fine If I run javaw myjarfile.jar

  • CTM - Forecast Consumption for Dependent Demand

    Hi We have a scenario where the Planning Strategy for a assembly part (say X) is set to a custom copy of 70 so that forecast is consumed by dependent demand. Forecasts are released from DP for such assemblies. The Parent of this assembly (say A) is d