I gave up on that and it works fine in like 5 lines of code with basic indexing.
For anyone that's interested ...
Using numpy.nonzero on a middle row and column can get the indexes of where the zeros start and stop and can convert to array and use min() max() to get the first and last indexes...
My understanding of while loops is that as soon as the condition is false it should terminate. I.e. The false condition is the exit.
The condition tests the first row and if it returns True then deletes it. So it's always checking the first row but each time it's a new first row.
when i do it with while loops i have
while numpy.all(array[0]==0)==True:
Calarray=numpy.delete(array,0,0)
so it checks each line and if its all zeros then it deletes that line.
But it doesn't terminate unless i manually press return.
If i run the while condition prior to executing i get...
Hi there,
I have 1024,1024 arrays (lots of them) which are really roughly 600,800 (it changes) and then buffered by zeros all the way around something like
000000000000000000
000000000000000000
000xxxxxxxxxxxxx000
000xxxxxxxxxxxxx000
000xxxxxxxxxxxxx000
000000000000000000
000000000000000000
i...
Hey,
thanks, that will help..
just out of curiosity... does the ndimage.convolve method from scipy do the filtering in the same way? that would make it a one liner...
I have large 2d matrices from dicom files that i wish to filter with a 3x3 mask. the image arrays are of varying size and are padded with one border of zeros for the edge handling of the mask. i need to iterate over every element in the array and multiply it by the mask. I've done it in SciLab...
Hey guys,
Doing some research in medical physics and for testing purposes I am tryin to set SLA photosensitive resin with just a desktop lamp .. It sets fine but the problem is it warps and I'd like to set a thin sheet like 10cm square and about 1-2mm thick and keep it flat.
Any brilliant ideas ?
so it looks like its this easy..
'array' is my array of shape [2,1024,1024]
to get the two 1024x1024 arrays out is simply
1stArray = array[0] and 2ndArray = array[1]
..
ill know for sure when i map them
Hi guys,
I have a dicom image from a QC spect acquisition.
reading the file in with dicom.read_file and pulling pixel data using numpy.pixel_array gives array of shape [2, 1024, 1024]
The 2 represents two images, one from each detector head on the spect scanner and the 1024x1024 are the...
Hi Readers,
I seem to have hit an elementary snag while fiddling in R...
i have a 5x5m surface interpolated at intervals of 0.01... giving 250,000 squares in my grid. i have roughly 20-30 xy cords where i want to retrieve the z value out of the data frame. does anyone know how to search an x y...
Is it possible to "build" atoms?
Was just thinking to myself, the world running out of resources etc... the most basic form of matter is the 3 subatomic particles... and all matter is made up of them. i did some googling but couldn't find much so I am wondering if one day it would be possible...
I agree with LastOneStanding, fairly sure it was a 1935 paper on the EPR Paradox written by Einstein Podolsky and Rosen, hence EPR... since at the time they actually had no idea what they had discovered... and it was later the Schrodinger called it entanglement.
If you google search EPR...
well id actually worked it out before i found the other solution, all it gave me was how to display the result.
i learn by deconstructing the problem. and that's how i get my understanding up too. reading straight out of a book can be quite ambiguous sometimes.
see, now when i go back...