I posted this before but it never appeared in my NG.
Don't know what I did wrong but here it is again.
Applying a mask I avoid the pixels on the boundary in case the entire image
is being filtered, so as not to access areas outside the image.
I'd like to do a better job - for example it the Roi does not include an
image boundary I should not avoid that boundary of the Roi.
I been thinking about it and it seems kind of involved.
Not hard to do but many cases to consider and much code
Before I do that I wonder if there is a built-in way to simplify the code.
Thanks in advance for any helpful suggestions
> I posted this before but it never appeared in my NG.
> Don't know what I did wrong but here it is again.
FWIW, both messages appeared on my server. Some newservers take quite a long
time between submitting a post and it being available to read (espectially if
they are having operational difficulties).
> Applying a mask I avoid the pixels on the boundary in case the entire
> image is being filtered, so as not to access areas outside the image.
>
> I'd like to do a better job - for example it the Roi does not include an
> image boundary I should not avoid that boundary of the Roi.
Please don't take this as a criticism, but as an attempt at a helpful
suggestion. Not many readers will have any idea what you are talking about
here. Your question is /very/ specific to the way that ImageJ works, and to
the concepts and APIs that programmers should use when creating plugins. Most
Java programmers will never have touched ImageJ at all, and won't recognise
your terms (I've played with it a bit, but not enough to answer your
question -- sorry). I realise that as a newcomer to Java you will find it hard
to see where ImageJ stops and Java begins, but that just makes it even more
important (if you want to get sensible help) that you indicate that your
question is ImageJ-related (ideally on the subject line).
Anyway, and FWIW, image processing code usually /is/ long and involved, with
awkward special cases at/near boundaries. I suspect that you'll just have to
live with it in this case.
-- chris
academic - 16 Feb 2006 13:58 GMT
>> I posted this before but it never appeared in my NG.
>> Don't know what I did wrong but here it is again.
[quoted text clipped - 4 lines]
> if
> they are having operational difficulties).
Still not on mine.
>> Applying a mask I avoid the pixels on the boundary in case the entire
>> image is being filtered, so as not to access areas outside the image.
[quoted text clipped - 18 lines]
> important (if you want to get sensible help) that you indicate that your
> question is ImageJ-related (ideally on the subject line).
That's an excellent idea. Thanks for taking the time to pass it on
Thanks again
> Anyway, and FWIW, image processing code usually /is/ long and involved,
> with
> awkward special cases at/near boundaries. I suspect that you'll just have
> to
> live with it in this case.
The thing that bothers is that there are four different image processor so
I'll have to write similar code four times, maybe differing only in the type
of the variables.
> -- chris
Chris Uppal - 16 Feb 2006 15:10 GMT
> The thing that bothers is that there are four different image processor so
> I'll have to write similar code four times, maybe differing only in the
> type of the variables.
Sounds like a good time to apply some sort of pre-processing. Create a
template file which contains "almost" Java code and then use any utility you
are happy with (an editor, Perl, awk, even another Java program) to substitute
the different types in automatically.
-- chris
academic - 16 Feb 2006 16:11 GMT
I just installed Vs2005 which has "code snippets" which I'll bet
conveniently does just what you suggested. I use it as a java editor and it
does a nice job.
Thanks for the suggestion.
>> The thing that bothers is that there are four different image processor
>> so
[quoted text clipped - 9 lines]
>
> -- chris
Oliver Wong - 16 Feb 2006 18:59 GMT
> The thing that bothers is that there are four different image processor so
> I'll have to write similar code four times, maybe differing only in the
> type of the variables.
I don't know the exact problem you're trying to solve, so I don't know
if this will help, but have you considered using generics to only write your
code once, and supply a different type each time?
- Oliver
academic - 16 Feb 2006 19:58 GMT
Sound great. I'll have to look that up.
I've heard about generics but didn't know java had it.
Thanks
>> The thing that bothers is that there are four different image processor
>> so I'll have to write similar code four times, maybe differing only in
[quoted text clipped - 5 lines]
>
> - Oliver
Chris Uppal - 17 Feb 2006 12:56 GMT
> Sound great. I'll have to look that up.
>
> I've heard about generics but didn't know java had it.
It has, but they may not be suitable for your purposes. They don't apply to
primitive types for one thing (int, byte, float, etc). They also have very
poor traction with arrays. I don't know exactly what you are doing, but if you
had code like:
byte[] data = new int[height * width];
for (int y = 0; y < height; y++)
{
for (x = 0; x < width; x++)
{
byte b = data[h*width + y]
... etc ..
and wanted to generalise that to handle arrays of float or int data instead of
bytes, then Java's generics wouldn't help at all.
Sad...
-- chris
academic - 17 Feb 2006 18:24 GMT
Thanks for the heads up.
I did it the long way.
Thanks again
>> Sound great. I'll have to look that up.
>>
[quoted text clipped - 23 lines]
>
> -- chris