- #1
mediocre
- 15
- 0
Hello,
I'm having a bit of trouble converting an 8 bit stream into a 10 bit one.
First i create intvalbin8, a Nx8 zero/one array where N is the byte length of the input data:
(6198 is the header offset factor)
Then i (hopefully) reshape it into a Nx10 one (intvalbin10) :
Transforming it into 10 bit integers with:
In my case this is a column of values, corresponding to a 3712 x 464 array.
The problem is that it somehow messes up the ordering od the indices.
When printing out only every fourth line, the image looks "fine".
(this is the most decent looking out of the four subsets)
)
This is the full, jumbled array
I have no clue whatsoever what is wrong here. I've tried transposing,flipping... the 8bit one while reshaping it, but to no avail.
Any help is much appreciated.
Kind regards,
Marko
I'm having a bit of trouble converting an 8 bit stream into a 10 bit one.
First i create intvalbin8, a Nx8 zero/one array where N is the byte length of the input data:
(6198 is the header offset factor)
Code:
j=1
do while (intvalout(i).gt.0)
intvalbin8(j,i-6198)=modulo(intvalout(i),2)
intvalout(i)=floor(real(intvalout(i))/2.)
j=j+1
end do
Then i (hopefully) reshape it into a Nx10 one (intvalbin10) :
Code:
intvalbin10=reshape(intvalbin8,shape(intvalbin10))
Transforming it into 10 bit integers with:
Code:
intvaldec10=0
do i=1,size(intvaldec10)
do j=1,10
intvaldec10(i)=intvaldec10(i)+intvalbin10(j,i)*2**(j-1)
end do
end do
In my case this is a column of values, corresponding to a 3712 x 464 array.
The problem is that it somehow messes up the ordering od the indices.
When printing out only every fourth line, the image looks "fine".
(this is the most decent looking out of the four subsets)
This is the full, jumbled array
I have no clue whatsoever what is wrong here. I've tried transposing,flipping... the 8bit one while reshaping it, but to no avail.
Any help is much appreciated.
Kind regards,
Marko