May 9, 2007 3:05 PM
Is there a way to calculate the area of a shape?
-
Like (0)
JET,
I found your post and script for calculating the area of a shape. Thank you for creating and posting the script. It's (almost!) exactly what I'm looking for. I have images over which I've traced multipe polygons (on the order of 40-100 polygons per image) and I'm ultimately trying to calculate the % area of the total image that the polygons cover. Your script works beautifully, except that with multiple polygons, I am forced to select each polygon individually. I have approximately 60 images to repeat this process over ...
I have some experience coding in Matlab and C -- is there any way to run a loop (or something) to automate this process and find the area of multiple polygons at one time? I would really appreciate your help!
Thank you!
Erin
I am looking for a method to measure a path area, like everybody else on this thread.
It seems that I am the least sophisticated person around, since I am not sure how to load the script JET provided.
Any hints for a beginner? I have a 9.0.1 Illustrator edition in Windows.
Also following the method Terri recommended, Shift-F12 did not produce the debugging palette.. awful luck - what is to be done?
thanks a bunch
Avi
Avi,
The scripts by James do not work in 9, and the debugging palette requires Ctrl+Alt+Shift+F12, but I doubt whether you can get to the bottom of it and see the area.
You may download the free Telegraphics Patharea filter (and the corresponding Pathlength) here (at least Patharea works for 9): http://www.telegraphics.com.au/sw/
An old thread from the Mac side, and with your lost ID, Jesse. By the way, John has said that when (maybe I should say if) they get the split ID solved, they may be able to merge doppelgangers into the main IDs.
What's this doing back up here? ;-)
I've since made a page describing the debug window method - I think you're missing a key there, but I'm not sure what the combo is on the PC...
Jesse,
The Win combination is Ctrl+Alt+Shift+F12 (exact match), and it does invoke the debugging palette.
However, in 10, apart from being somewhat simpler, even when a path is chosen it says:
... objects
Artwork Object: <no current>
So I believe it only works from CS on.
Some names from the past.
..appreciate very much the feedback.. indeed I have a sorry old Illustrator version. I was able to invoke the pallette with the combination you posted but the path area was not there. So I downloaded Jacob's filter and now I am trying to see how to plug it in. If you have a hint, I appreciate -
thanks again to both of you!
Avi
Avi,
Judging from 10 (on XP), I believe it is (expressed as path, > means \):
C:>Program Files>Adobe>Illustrator 9>Plug-Ins>Illustrator Filters
Jacob
It worked very well - great stuff!. I am a physician and I am working on cardiac MRI.. such as calculating the heart function using slices of heart images in systole and diastole (when the heart is squeezed or full of blood).
.. we can write a little medical paper comparing really pricey software (GE, Siemens, Medis you name it..) with this method for people with not too many pennies in their pocket. The advantage of using Illustrator is that you can blow up the images up to the point of loosing resolution, and trace the margins of the heart with an accuracy that would make any GE guy cry for his mama..
I thought even a cm further.. for simple-minded people (such as physicians for example) one would like a way to input the area of one slice directly into an equation. For example would be a way to create a routine that would take the number of the area of one slice and input it in this equation? Such as to create a little square where you put the slice, you trace it and then the program takes that number and pitches it in the equation without you writing it down on a paper.
thanks again!
Avi
You are welcome, Avi.
I am trying to buy CS5 for the hospital I work with (they said more or less with a joke they would not accept on their computers stuff older than the hospital itself). Just to see if I can use the Telegraphics plug-in I downloaded a trial version of CS5. Surprisingly it did not have the Filters tab on it. I assume this is just a drawback of the trial version, and I will find that particular tab on the real product. Is this accurate? Or should I find the plug-ins and filters on a different tab?
Thanks for info
Avi
Filters are now in the Object menu.
I found this whole thread very interesting. I remember stumbling across it first time it appeared and was very happy to rediscover it as it contained Teri's trick window which I'd forgotten about ![]()
It inspired me to add a forth method to the equation, which just got publishing on our Astute Graphics blog: www.astutegraphics.com/blog/calculating-an-objects-area-in-illustrator /
I thought that it may be of interest as it provides a method to calculate the area of all object types - including images, even if the result is more approximate compared to the precise results offered by the afore-mentioned script, plugin and debugging window. But I concede that the method isn't free to those who haven't already bought Phantasm CS Publisher, which the other methods are.
I wanted to thank all those who contributed to this thread, especially James (JET) and Toby (Telegraphics) for producing tools I genuinely use myself!
Nick
Nicholas,
It is inappropriate to post links on your website to someone else's website without asking permission.
JET
JET,
All links removed as requested.
Nick
Thank you. I trust you will now remove the completely unnecessary reference to my script and the "removed at author's request" note.
This comment on your site, by the way, is erroneous:
function(){return A.apply(null,[this].concat($A(arguments)))}
Each method...all have the same disadvantage; they can only provide a result for simple paths – not compound paths...
Illustrator's Javascript model does not provide an area property for a CompoundPathItem. That doesn't mean you can't get the area of a CompoundPathItem via AI's Javascript. Just because I didn't bother to do so when I keyed my script--which was written for my own purposes and mentioned only in casual threads in this forum by me, and not intended for anyone else to appropriate to buttress the virtues of their plug-in--doesn't mean it can't be done.
The AI Javascript model does provide access to a CompoundPathItem's subpaths via its pathItems property. Computing the area of a CompoundPathItem via Javascript is therefore fairly trivial, by using the area and polarity properties of the pathItem object. All one has to do is loop through the pathItems of the CompoundPathItem and either add or subtract their areas, based on whether the polarity property is PolarityValues.NEGATIVE or PolarityValues.POSITIVE.
Finding areas of other object types would be similarly trivial. The area of a raster image could simply be based on its bounds. Getting the area of a clipping path is a simple matter of directSelecting the path before running the script.
So you might also reconsider that particular marketing argument for your plug-in.
JET
JET - please re-read my blog post. You will now find no mention of "JET..." (we have to say there were 3 methods in this original forum pot... because there are). You will also perhaps see that I clearly state the the methods here are free and praise them. I really don't see anybody buying a £139 plugin just for this solution. But it made me curious to see if there was another method with our tool. Call it marketing if you like, but I felt I was clear, honest and generous in my praise of what you have achieved with your scripts.
I am sure that much more is possible with scripts.
I trust this is now the conclusion of this thread of the debate. I had no intention of upsetting you. Life's too short.
Now back to enjoying Sunday.
Nick
dude wher eon earth did you come up with that?it seems like a buried
secret of adobe.nice posting ;-)
Nick,
Just a few Sunday comments:
It is worth mentioning that the debugging window does not show the required information up to 10, so this method is only usable from CS (hopefully) on; this might be mentioned in Important notes.
You have a few misspellings in the blog, the most important one being Terri which should be Teri; a rather common one, regularly seen in this forum.
With regard to your mentioning non Phantasm solutions, as I see it, your explicitly non mentioning the solution by James is rather explicit and thereby conspicuous; besides, the contents is not quite updated, and your mentioning their inability to deal with compound paths still includes all three methods, in other words also the one by James.
I would suggest your changing the introduction as follows (shown as two sets with removal of the BoldItalics in the first one and insertion of the BoldItalics in the second, because seemingly colours and strikethrough do not work here in the forum):
Following a long-running thread on the Adobe Illustrator forum [click here to read], it emerged that there were three (We have agreed to not discuss the third.) methods to measure the area of a vector path within Illustrator. It was interesting to see that each approach was different – and free – and included a plugin and a hidden window within Illustrator intended for debugging by the development team. Each method has it own advantages, but all have the same disadvantage; they can only provide a result for simple paths – not compound paths, clipped paths, etc.
In this tip, we’ll have a look at all the previously-disclosed methods plus a forth option making unique use of Phantasm CS Publisher’s advanced Ink Coverage tool which caters for all object types, including compound paths, editable text, groups and even images!
Following a long-running thread on the Adobe Illustrator forum [click here to read], it emerged that there are different methods to measure the area of a vector path within Illustrator. It was interesting to see that each approach was different – and free – and included a plugin and a hidden window within Illustrator intended for debugging by the development team. Each of the two methods has it own advantages, but both have the same disadvantage; they can only provide a result for simple paths – not compound paths, clipped paths, etc.
In this tip, we’ll have a look at both the previously-disclosed methods plus a third option making unique use of Phantasm CS Publisher’s advanced Ink Coverage tool which caters for all object types, including compound paths, editable text, groups and even images!
Non mentioning is rarely served by mentioning, as may be seen from the Robe tale.
function(){return A.apply(null,[this].concat($A(arguments)))}
we have to say there were 3 methods in this original forum pot... because there are
Excuse me? You "have to"? Why do you "have to" mention a specific informal thread in an open user-to-user forum at all on your commercial site?
function(){return A.apply(null,[this].concat($A(arguments)))}
You will also perhaps see that I clearly state the the methods here are free and praise them.
And what makes you assume I desire any notoriety from mention on your commercial site? Just because you couch it as [gratuitous and patronizing] praise?
I agree completely with Jacob's assessment that "non mentioning" constitutes mentioning. As far as his suggested edits, though, I would go much further: Several methods exist for determining the area of a vector path in Illlustrator: Third-party plug-ins designed specifically for the purpose exist. Illustrator's built-in scripting support provides access to the area property of pathItems. There's even a little-known "easter egg" built into the program itself which can be invoked by [the keyboard shortcuts]. Did you know that Phantasm CS Publisher can also be used to find the area of a selection? Here's how: [Description of YOUR method only]. But, of course, that straightforward and appropriate treatment is much shorter. It doesn't fill up your "blog" with others' content as if it's some kind of know-all-end-all resouce about finding the area of a path. It doesn't explicity compare your product's methods with an entirely non-commercial, off-the-cuff approach offered by an individual in an informal user-to-user forum, who may not want your self-serving "praise," no matter how "flattering" you try to make it. I frequently get requests from individuals, commercial sites, and authors to link to or make mention of my scripts web content. I've always turned them down. My reasons are my own; they are valid, and I don't have to explain or justify them to anyone. The point is, it is customary to ask before you appropriate someone else's web content in a thinly-veiled attempt to add value to yours. JET
Hi Jacob, everybody
..restarting messages on this thread.
We did since last August quite a few cardiac MRI patients using the telegraphics plug-in and it is working great. Nice resolution, quite affordable price in comparison with what medical companies offer.
Again what we do is to copy and paste images from the MRI machine (via a CD) in Illustrator, trace the surface areas of the heart slices recorded by the machine and then calculate various metrics used by cardiologists (most important is the "ejection fraction", which measure the pumping function of the two lower chambers: either the right or the left ventricle).
There are two tedious steps in this process. One is the copy and paste and the other is the contouring.
I was wandering wether I can have a way automatize the first function. Specifically it would be nice to have a tool to export a set of images (and one can input values in regards to what series of images one wants to export) from DICOM media (Digital Imaging and Communications in Medicine) to Illustrator. Any ideas if there are any plug-ins available, or if one can be created.
This is slighly unrelated to this thread so probably I will start another one... called "Is there a way to: Export images from DICOM media into Illustrator?"
http://forums.adobe.com/message/3586323?tstart=0
Regards and thanks
Avi
Just wanted to thank you for the script. Saved the day and a lot of work for me
!
Copyright © 2011 Adobe Systems Incorporated. All rights reserved.
Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy (updated 07-14-2009).