[Rtk-users] Is there a way to signal to rtk-ProjectionsReader that RawImage has files and columns transposed?

Fernando Hueso González fernando.hueso at uv.es
Mon May 16 14:18:59 UTC 2022


Hello RTK-users,

as a newbie, I am not yet familiar with the way how to correctly use 
RTK, so my apologies if I am asking something dumb.

My question is (short version):

Is there a way to use rtk::ProjectionsReader with images that have files 
and columns transposed with respect to the convention (wrt the rotation 
axis)? And if not, would it be possible to add such a feature in the future?

The long story:

Currently, I am trying to migrate a script I wrote in MATLAB, which 
correctly performs a 3D reconstruction based on 360 projections (2D). 
Thus, I am sure that my geometry parameters and input data are correct. 
I open them exaclty in the same format both in MATLAB and in RTK (as 
uint16).

The MATLAB script does something like this (The flip below is because 
projections go from 0, -1, -2, ... degrees):

ctWidth = 768 ctHeight = 486 pitch = 0.075*4 allProjections = 
zeros(ctWidth,ctHeight,ctProjections,'uint16'); for proj = 
1:ctProjections     allProjections(:,:,proj) = 
fread(fopen(projfile(proj),'rb','l'),[ctWidth,ctHeight],'uint16'); end 
Di = 90; % isocenter to detector distance mm Ds = 151; % isocenter to 
source distance mm offset = 1.6; % mm for i = 1:ctHeight     Ifan(i) = 
ifanbeam( ...     
log(16383./flip(single(squeeze(allProjections(round(offset*2/pitch):end,i,:))),2)), 
...     Ds/pitch, ...         'FanSensorSpacing',Ds/(Di+Ds), ...         
'FanSensorGeometry','line', ...         'Filter', 'Hann', ...         
'OutputSize', 700); end

And after saving Ifan, it correctly generates a 3D image that I can open 
with Slicer3D. ( A cylinder with some wires).

Now, if I try to do the same thing with RTK in C++, I cannot seem to 
find the proper settings to do the exact same reconstruction. First I 
try to define the geometry and input format:

usingGeometryType=rtk::ThreeDCircularProjectionGeometry;

GeometryType::Pointergeometry=GeometryType::New();

for(size_ti=0;i<360;i++){

constfloatangle=-i;

constfloatsid=151;

constfloatsdd=90+151;

geometry->AddProjection(sid,sdd,angle,1.6);

}

ImageIOType::Pointerio=ImageIOType::New();
io->SetDimensions(0,ctWidth);
io->SetDimensions(1,ctHeight);
io->SetByteOrderToLittleEndian();
io->SetOrigin(0,-detPitchU*detSizeU/2);
io->SetOrigin(1,-detPitchV*detSizeV/2);
io->SetSpacing(0,detPitchU*binningU);
io->SetSpacing(1,detPitchV*binningV);


usingNameGeneratorType=itk::NumericSeriesFileNames;
NameGeneratorType::PointernameGenerator=NameGeneratorType::New();
nameGenerator->SetSeriesFormat(subfolder+"/%d.ct");
nameGenerator->SetStartIndex(0);
nameGenerator->SetEndIndex(359);
nameGenerator->SetIncrementIndex(1);

usingReaderType=rtk::ProjectionsReader<OutputImageType>;

ReaderType::Pointerreader=ReaderType::New();

reader->SetFileNames(nameGenerator->GetFileNames());

reader->SetImageIO(io);

reader->SetI0(16383);

reader->Update();

After reconstructing, it looks then transposed with respect to the 
MATLAB version. The circular section is on the right, and the vertical 
cylinder on the left. (Sorry about it not being centered, that's my 
bad.). (Changing 'nColumns' with 'nRows' of course does not solve the 
issue, as this would lead to wrong 2D images being imported.)

So the question would be if there is a way to solve this without having 
to mess around with my data. Maybe there is a 'transpose flag' that I 
have overlooked when calling rtk-projectionsreader? If you prefer, I can 
share with you the full script and input data via my Cloud-Drive.

Thanks in advance for the help! Have a nice weekend.

Fernando.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/rtk-users/attachments/20220516/3fa8d089/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rPi4JCNyfeRHibCs.png
Type: image/png
Size: 149705 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/rtk-users/attachments/20220516/3fa8d089/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ePeBVtJM83MMDGhb.png
Type: image/png
Size: 181873 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/rtk-users/attachments/20220516/3fa8d089/attachment-0003.png>


More information about the Rtk-users mailing list