« first day (2517 days earlier)      last day (704 days later) » 

7:23 AM
posted on May 21, 2022 by Cris Luengo

Today saw another DIPlib release, version 3.2.0. As usual, there is some new functionality, some improvements to existing functionality, and some bug fixes, see the change log for details. An increasing number of people is using the Python bindings, and I’ve been using them extensively at work …

4
 
 
1 hour later…
8:37 AM
@Feeds \O/!!!!!!!!!!!!!!!!!!
 
9:08 AM
whoop whoop
> Here is an example of using the matrix multiplication: converting the RGB image to gray scale (obviously one would normally use dip.ColorSpaceManager for this purpose):

img = dip.Transpose(img) @ [0.3, 0.6, 0.1]

Yes, the syntax here is still a bit awkward, a list of values is always interpreted as a column vector.
@CrisLuengo I don't understand this one, but then again I'm not one of your users. Does this mean that rgb channels are the leading dimension? I don't know about the [z y x] you mention earlier in the post, but I definitely know that RGB is normally the last axis.
And I'm not sure what you mean by the "syntax is a bit awkward" and "column vector" thing, but anyway I assume [0.3, 0.6, 0.1] @ img would work except for the transpose of the remaining axes.
And brave move changing the semantics of *, hope you don't get too much flak for that
@AndrasDeak--СлаваУкраїні of course that still won't make @= work
For what it's worth numpy doesn't implement @= yet entirely
 
 
4 hours later…
1:46 PM
@AndrasDeak--СлаваУкраїні An image in DIPlib is not a matrix. It is an nD array of pixels, and each pixel is either a scalar, a vector or a matrix. You don’t index the channel using the syntax of spatial indexing, it is a totally separate concept. This is how you can do a pixel wise matrix multiplication. None of this syntax would work if the tensor and spatial dimensions were equal.
This also allows storage order to not matter.
[0.3, 0.6, 0.1] @ dip.Transpose(img) would create a 3x3 matrix at each pixel.
Oh, and @= does work because a dip.Image can reallocate its memory when necessary. It won’t be computed in place, a new data segment will be created.
 
@CrisLuengo I removed the transpose :P
@CrisLuengo thanks, I'm missing too much context then
@CrisLuengo that's fair
 
Yeah, you can do something complex like dip.Create0D([0.3, 0.6, 0.1]).Transpose() @ img. Which is unfortunate, I think.
 
 
2 hours later…
4:07 PM
@CrisLuengo Interesting, didn't know that!
One day I'll read the manual, I promise:)
 
 
3 hours later…
6:38 PM
@flawr here’s some examples for stuff you cannot do so easily without the concept of a tensor image: diplib.org/diplib-docs/why_tensors.html
 
7:30 PM
@CrisLuengo these are some nice examples thanks! I didn't know about the stain-unmixing, that was quite neat!
I do see the advantages this offers, but then again I also got used to the way numpy&co handle it by letting the user use every dimension of a nd-array for every role they possibly want, without having a specific image object
but at the same time it is also its disadvantage, you don't necessarily know which dimension is used for what, where this has a clearly defined meaning in diplib
 
Yeah, NumPy is more flexible than MATLAB in that respect. But you still end up doing a lot of unnecessary bookkeeping, remembering which dimensions mean what and so on. I’m so used to the DIPlib way (which we introduced in the DIPimage toolbox in MATLAB in 1999 or 2000) that I get annoyed at all other options. :D
 
Humans don't like change:)
 
So true!
 
In a recent release of pytorch they started allowing naming the dimenions of an array. So you could have e.g. an image and name the dimensions H, W, C, and if you had to sum over the channels you could just write img.sum(dim='C')
 
Especially us old specimens.
@flawr That is really neat, I like it!
 
7:38 PM
Now I'm not sure if you're including me in us or not :D
 
Too bad they refer to a stack of images as a “tensor”…
 
@CrisLuengo they just name arrays tensors
 
@flawr I was referring to myself, don’t know how old you are. :)
 
I'm relieved:)
 
An image is not a matrix, a stack of images is not a tensor. <grumble>
 
7:40 PM
but are pixels squares?
or are they points?
 
No, they’re samples!
I’ve always used the point sampling paradigm.
 
but the fun starts when you have to embed a pixel image in a coordinate system
i.e. the question of whether the integer coordinates are at the center of the pixel-square or at the corners
 
A CCD sensor with square pixels can be modeled by a convolution with the pixel shape, followed by point sampling.
@flawr If a pixel is a point, the pixel’s coordinates correspond to that point. How you want to do interpolation to fill the space in between samples is up to you. :)
 
ok I'm convinced:)
@CrisLuengo did you ever have to work with non-rectangular pixel shapes?
 
Actually, OpenCV goes to great lengths when rescaling an image to get the edges of the input and output images to align, taking into account the extent of the pixels. Leads to very weird and unexpected results.
 
7:47 PM
yeah I think there is also an option in pytorch when rescaling images, whether you want the edges of the corner pixels aligned or their centers
 
@flawr There are people who swear by hexagonal pixels. In theory they’re more efficient. But implementation sucks. I haven’t seen any software using them since the late 1990’s, when I started working in this field. Software like that was more popular in the 1980’s and early 1990’s.
So no, never had to work with non-rectangular pixels. Luckily.
I had a colleague at Uppsala that did a lot of research into the 3D equivalent of hexagonal pixels (BCC and FCC grids). Cool in theory, not sure if it’s worth it in practice.
 
@CrisLuengo Ah efficiency in terms of area right (in a hexagonal grid the gap between pixels would take up less area)?
@CrisLuengo That sounds very fancy
I think I once heard about sensors in CT that have some kind of funny sizes, where the size of the next sensor always doubles (or maybe a different factor), with the idea that you can connect the previous sensors to act as one, and therefore get different FOVs with the same number of "pixels" but a minimal amount of sensors
 
@flawr yea, something about needing fewer samples to get the same resolution.
@flawr that’s interesting! Will have to look that up, see if I can learn more.
 
let me check, maybe I can still find it somewhere
ah ok I think it was about the thickness of the slices in CT
you can find lots of example with "adaptive CT detector array"
* + "multislice"
@AnderBiguri probably knows something about this stuff
@CrisLuengo a similarly interesting idea I heard a while ago was about cameras that don't just take picture after picture in a discrete time, but instead the pixels somehow independently decide whether there was a big enough change and then "fire". So over time you just get a whole stream of pixels that fired with a very high temporal resolution, but the stream "density" over time could obviously vary a lot. I have no idea how you'd process that kind of data in a meaningful way:)
But I thought it was interesting because it challenged the notion of how a camera is supposed to work.
 
8:15 PM
@flawr so each pixel needs some intelligence to decide whether to send its data out. Would be quite interesting indeed!
I have seen cameras with built-in intelligence, they send out a picture only if something happens in the scene, or they detect the subject and send a cropped picture around that out. All to reduce the amount of data transferred.
 
@CrisLuengo as far as I remember the prototype they had the firing was just physics based, there was some kind of accumulator that got "emptied" after a certain threshold
and I think they also did some kind of asynchronous processing but that was way above my head
 
Maybe useful in astronomy or fluorescence microscopy? That’s where you want to measure light only where the is light to be measured.
 
9:15 PM
Somehow I get the feeling this guy is mad at me because I didn't completely understand his question the way he inteded but my answer is a trivial step away from the solution they wanted? stackoverflow.com/questions/72318912/…
 
@flawr Thanks!
@flawr wow, what an asshole.
 
9:33 PM
It just surprized me to get a rection like this from someone with so many green internet points
 
@flawr This is how most CT scanners work yes. You have a 1D detector, but the speed of rotation+pitch determines your slice thickness
 
@flawr sounds like xarray, cc @CrisLuengo
 
@AndrasDeak--СлаваУкраїні that sounds like pandas-done-right:)
I didn't know that library before, but it sounds really nice!
 
@CrisLuengo oh, BCC and FCC are right up my alley (sort of)
 
 
1 hour later…
10:51 PM
@AndrasDeak--СлаваУкраїні crystallography? I thought Adriaan was the rock lover here!
@AndrasDeak--СлаваУкраїні That looks really good! Thanks!
 

« first day (2517 days earlier)      last day (704 days later) »