From pascal.bourgault at gmail.com Tue Apr 4 11:45:26 2017 From: pascal.bourgault at gmail.com (Pascal Bourgault) Date: Tue, 4 Apr 2017 11:45:26 -0400 Subject: [Rtk-users] itk::SmartPointer assignment : Base vs. Derived cuda class bug Message-ID: Hi, I'm currently trying to the rtkConjugateGradientConeBeamReconstructionFilter, but I am not able to compile anyof my codes because of the following error: /usr/local/include/RTK-1.3/rtkConjugateGradientConeBeamReconstructionFilter.hxx:43:29: error: no match for ?operator=? (operand types are ?rtk::DisplacedDetectorImageFilter, itk::Image >::Pointer {aka itk::SmartPointer, itk::Image > >}? and ?rtk::CudaDisplacedDetectorImageFilter::Pointer {aka itk::SmartPointer}?) m_DisplacedDetectorFilter = rtk::CudaDisplacedDetectorImageFilter::New(); (And many more instances of the same kind) It seems that the SmartPointer of the CudaDisplacedDetectorImageFilter cannot be assigned to its base-class SmartPointer for some reason. As the bugs occurs in the RTK code directly, I am a bit confused and guess it has something to do with my configuration? Perhaps it has to do with Cuda, because it seems this bug only occurs when I the derived class is Cuda-based. I use RTK-1.3.0, ITK-4.9.0 (as packaged in libinsighttoolkit4-dev on Ubuntu 16.04), gcc 5.4 and Cuda 8.0. Do you have any ideas of why this error occurs? Am I missing something, some unset options? Thanks! -- Pascal -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon.rit at creatis.insa-lyon.fr Tue Apr 4 12:16:07 2017 From: simon.rit at creatis.insa-lyon.fr (Simon Rit) Date: Tue, 4 Apr 2017 18:16:07 +0200 Subject: [Rtk-users] itk::SmartPointer assignment : Base vs. Derived cuda class bug In-Reply-To: References: Message-ID: Hi Pascal, Are you trying a piece of code which is yours or failing to compile RTK? It seems that you have compiled RTK with the Cuda option. Therefore, you should instantiate your filters with an itk::CudaImage and not a regular itk::Image. This doesn't prevent the use of the CPU in the conjugate gradient filter with CPU operators. See for example the application code for both Cuda and non-Cuda versions: https://github.com/SimonRit/RTK/blob/master/applications/rtkconjugategradient/rtkconjugategradient.cxx Simon On Tue, Apr 4, 2017 at 5:45 PM, Pascal Bourgault wrote: > Hi, > > I'm currently trying to the rtkConjugateGradientConeBeamReconstructionFilter, > but I am not able to compile anyof my codes because of the following error: > > /usr/local/include/RTK-1.3/rtkConjugateGradientConeBeamRe > constructionFilter.hxx:43:29: error: no match for ?operator=? (operand > types are ?rtk::DisplacedDetectorImageFilter, > itk::Image >::Pointer {aka itk::SmartPointer DisplacedDetectorImageFilter, itk::Image > > >}? and ?rtk::CudaDisplacedDetectorImageFilter::Pointer {aka > itk::SmartPointer}?) > m_DisplacedDetectorFilter = rtk::CudaDisplacedDetectorImageFilt > er::New(); > > (And many more instances of the same kind) > > It seems that the SmartPointer of the CudaDisplacedDetectorImageFilter > cannot be assigned to its base-class SmartPointer for some reason. As the > bugs occurs in the RTK code directly, I am a bit confused and guess it has > something to do with my configuration? Perhaps it has to do with Cuda, > because it seems this bug only occurs when I the derived class is > Cuda-based. > > I use RTK-1.3.0, ITK-4.9.0 (as packaged in libinsighttoolkit4-dev on > Ubuntu 16.04), gcc 5.4 and Cuda 8.0. > > Do you have any ideas of why this error occurs? Am I missing something, > some unset options? > > Thanks! > > -- > Pascal > > _______________________________________________ > Rtk-users mailing list > Rtk-users at public.kitware.com > http://public.kitware.com/mailman/listinfo/rtk-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pascal.bourgault at gmail.com Tue Apr 4 12:56:46 2017 From: pascal.bourgault at gmail.com (Pascal Bourgault) Date: Tue, 4 Apr 2017 12:56:46 -0400 Subject: [Rtk-users] itk::SmartPointer assignment : Base vs. Derived cuda class bug In-Reply-To: References: Message-ID: That was it, thanks a lot! I am using code from someone else but didn't see that the itkCudaImage declaration was commented for some reason. I did compile RTK without problems. I am now integrating rtk methods into a bigger project. Thanks again! -- Pascal 2017-04-04 12:16 GMT-04:00 Simon Rit : > Hi Pascal, > Are you trying a piece of code which is yours or failing to compile RTK? > It seems that you have compiled RTK with the Cuda option. Therefore, you > should instantiate your filters with an itk::CudaImage and not a regular > itk::Image. This doesn't prevent the use of the CPU in the conjugate > gradient filter with CPU operators. See for example the application code > for both Cuda and non-Cuda versions: > https://github.com/SimonRit/RTK/blob/master/applications/ > rtkconjugategradient/rtkconjugategradient.cxx > Simon > > > On Tue, Apr 4, 2017 at 5:45 PM, Pascal Bourgault < > pascal.bourgault at gmail.com> wrote: > >> Hi, >> >> I'm currently trying to the rtkConjugateGradientConeBeamReconstructionFilter, >> but I am not able to compile anyof my codes because of the following error: >> >> /usr/local/include/RTK-1.3/rtkConjugateGradientConeBeamRecon >> structionFilter.hxx:43:29: error: no match for ?operator=? (operand >> types are ?rtk::DisplacedDetectorImageFilter, >> itk::Image >::Pointer {aka itk::SmartPointer> edDetectorImageFilter, itk::Image > >}? >> and ?rtk::CudaDisplacedDetectorImageFilter::Pointer {aka >> itk::SmartPointer}?) >> m_DisplacedDetectorFilter = rtk::CudaDisplacedDetectorImag >> eFilter::New(); >> >> (And many more instances of the same kind) >> >> It seems that the SmartPointer of the CudaDisplacedDetectorImageFilter >> cannot be assigned to its base-class SmartPointer for some reason. As the >> bugs occurs in the RTK code directly, I am a bit confused and guess it has >> something to do with my configuration? Perhaps it has to do with Cuda, >> because it seems this bug only occurs when I the derived class is >> Cuda-based. >> >> I use RTK-1.3.0, ITK-4.9.0 (as packaged in libinsighttoolkit4-dev on >> Ubuntu 16.04), gcc 5.4 and Cuda 8.0. >> >> Do you have any ideas of why this error occurs? Am I missing something, >> some unset options? >> >> Thanks! >> >> -- >> Pascal >> >> _______________________________________________ >> Rtk-users mailing list >> Rtk-users at public.kitware.com >> http://public.kitware.com/mailman/listinfo/rtk-users >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Robert.Calliess at gmx.de Wed Apr 5 10:26:10 2017 From: Robert.Calliess at gmx.de (=?UTF-8?Q?=22Robert_Callie=C3=9F=22?=) Date: Wed, 5 Apr 2017 16:26:10 +0200 Subject: [Rtk-users] fdk reconstruction filter - brightness and contrast issues References: , , Message-ID: An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 184.png Type: image/png Size: 66746 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 185.png Type: image/png Size: 66746 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: brightness.png Type: image/png Size: 161289 bytes Desc: not available URL: From wuchao04 at gmail.com Wed Apr 5 10:55:57 2017 From: wuchao04 at gmail.com (Chao Wu) Date: Wed, 5 Apr 2017 16:55:57 +0200 Subject: [Rtk-users] fdk reconstruction filter - brightness and contrast issues In-Reply-To: References: Message-ID: Hi Robert, First of all the geometry does not look right. Do you have more information about the geometric parameters of your system? Regards, Chao 2017-04-05 16:26 GMT+02:00 "Robert Callie?" : > Hello, > i have reconstructed an USB stick with the fdk reconstruction filter. > Within the slices there are different levels of brightnes. And the contrast > seems to be low. > What may be the reasons for a low contrast and the differences in > brightness of the slices ? > Thanks for helping. > > Kind regards, > Robert > > _______________________________________________ > Rtk-users mailing list > Rtk-users at public.kitware.com > http://public.kitware.com/mailman/listinfo/rtk-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From DMEDMUNDS at mgh.harvard.edu Fri Apr 7 11:34:09 2017 From: DMEDMUNDS at mgh.harvard.edu (Edmunds, David Michael) Date: Fri, 7 Apr 2017 15:34:09 +0000 Subject: [Rtk-users] CUDA library linking issues with CMake Message-ID: <3DB53C5A15F5A745A0B03B9BEE4FAC30140BE7DC@PHSX10MB12.partners.org> Hi all, This is my first post. I am really enjoying the RTK library so far! I have a question about including RTK in my own project using CMake. I include it in my own CMakeLists.txt file using: find_package(RTK) include(${RTK_USE_FILE}) Then later: target_link_libraries(MyExecutable ${RTK_LIBRARIES} ${SOME_OTHER_LIBRARIES}) The problem is, ${RTK_LIBRARIES} includes a reference to cudart.lib, the non-static version of the CUDA RT. This happens regardless of whether CUDA_USE_STATIC_CUDA_RUNTIME is checked or unchecked when I configure RTK. The other libraries I depend on include references to cudart_static.lib, the static version of the CUDA RT. This leads to multiple definition errors at link time in my project, since symbols are present in both cudart.lib and cudart_static.lib. I can resolve this problem by removing cudart.lib from ${RTK_LIBRARIES} manually in my CMakeLists.txt, but this seems like a hack. Is this a problem with the RTK CMake files, or am I making some other mistake? Thanks for your help, Dave The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail. -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon.rit at creatis.insa-lyon.fr Sun Apr 9 04:27:22 2017 From: simon.rit at creatis.insa-lyon.fr (Simon Rit) Date: Sun, 9 Apr 2017 10:27:22 +0200 Subject: [Rtk-users] CUDA library linking issues with CMake In-Reply-To: <3DB53C5A15F5A745A0B03B9BEE4FAC30140BE7DC@PHSX10MB12.partners.org> References: <3DB53C5A15F5A745A0B03B9BEE4FAC30140BE7DC@PHSX10MB12.partners.org> Message-ID: Hi, Welcome! It's very likely that there is a problem with the RTK cmake files but I wouldn't know how to correct them. Maybe you can check in the other libraries you use how they deal with this. Currently, when CUDA is used, we always link RTK to the library defined by the cmake variable ${CUDA_CUDART_LIBRARY}. Maybe this is no the correct way of doing it? Simon On Fri, Apr 7, 2017 at 5:34 PM, Edmunds, David Michael < DMEDMUNDS at mgh.harvard.edu> wrote: > Hi all, > > > > This is my first post. I am really enjoying the RTK library so far! > > > > I have a question about including RTK in my own project using CMake. I > include it in my own CMakeLists.txt file using: > > > > find_package(RTK) > > include(${RTK_USE_FILE}) > > > > Then later: > > > > target_link_libraries(MyExecutable ${RTK_LIBRARIES} > ${SOME_OTHER_LIBRARIES}) > > > > The problem is, ${RTK_LIBRARIES} includes a reference to cudart.lib, the > non-static version of the CUDA RT. This happens regardless of whether > CUDA_USE_STATIC_CUDA_RUNTIME is checked or unchecked when I configure RTK. > > The other libraries I depend on include references to cudart_static.lib, > the static version of the CUDA RT. This leads to multiple definition errors > at link time in my project, since symbols are present in both cudart.lib > and cudart_static.lib. I can resolve this problem by removing cudart.lib > from ${RTK_LIBRARIES} manually in my CMakeLists.txt, but this seems like a > hack. > > > > Is this a problem with the RTK CMake files, or am I making some other > mistake? Thanks for your help, > > > > Dave > > > > > > The information in this e-mail is intended only for the person to whom it > is > addressed. If you believe this e-mail was sent to you in error and the > e-mail > contains patient information, please contact the Partners Compliance > HelpLine at > http://www.partners.org/complianceline . If the e-mail was sent to you in > error > but does not contain patient information, please contact the sender and > properly > dispose of the e-mail. > > _______________________________________________ > Rtk-users mailing list > Rtk-users at public.kitware.com > http://public.kitware.com/mailman/listinfo/rtk-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sareh.borhani at gmail.com Sun Apr 16 16:27:54 2017 From: sareh.borhani at gmail.com (sare Borhani) Date: Sun, 16 Apr 2017 22:27:54 +0200 Subject: [Rtk-users] RTK-user Message-ID: Dear RTK.User, I'm using python wrapped version of RTK. I used the only example of that for reconstruction.It works perfectly. The problem is that I need to simulate an artifact on projection 2D images, so first I got each 2D images of stack reiImage by *srtk.GetArrayFromImage(reiImage) *and then I applied a polynomial on that to simulate an artifact.NOW need to extract these artifacted-images again to the simpleRTK image to be able to reconstruct it at the end. I thought maybe *srtk.GetImageFromArray* works, but it doesn't.Can you pls help me.I'm really hopeless. Here is the Example; from __future__ import print_functionimport SimpleRTK as srtkimport sysimport osimport matplotlib.pyplot as pltimport matplotlib.cm as cm if len ( sys.argv ) < 2: print( "Usage: RTKFirstReconstruction " ) sys.exit ( 1 ) # Defines the RTK geometry object geometry = srtk.ThreeDCircularProjectionGeometry() numberOfProjections = 360 firstAngle = 0 angularArc = 360 sid = 600 # source to isocenter distance in mm sdd = 1200 # source to detector distance in mm isox = 0 # X coordinate on the projection image of isocenter isoy = 0 # Y coordinate on the projection image of isocenterfor x in range(0,numberOfProjections): angle = firstAngle + x * angularArc / numberOfProjections geometry.AddProjection(sid,sdd,angle,isox,isoy) constantImageSource = srtk.ConstantImageSource() origin = [ -127.5, -127.5, 0. ] sizeOutput = [ 256, 256, numberOfProjections ] spacing = [ 1.0, 1.0, 1.0 ] constantImageSource.SetOrigin( origin ) constantImageSource.SetSpacing( spacing ) constantImageSource.SetSize( sizeOutput ) constantImageSource.SetConstant(0.0) source = constantImageSource.Execute() rei = srtk.RayEllipsoidIntersectionImageFilter() semiprincipalaxis = [ 50, 50, 50] center = [ 0, 0, 0]# Set GrayScale value, axes, center... rei.SetDensity(20) rei.SetAngle(0) rei.SetCenter(center) rei.SetAxis(semiprincipalaxis) rei.SetGeometry( geometry ) reiImage = rei.Execute(source) # Create reconstructed image constantImageSource2 = srtk.ConstantImageSource() origin = [ -63.5, -63.5, -63.5 ] sizeOutput = [ 128, 128, 128 ] constantImageSource2.SetOrigin( origin ) constantImageSource2.SetSpacing( spacing ) constantImageSource2.SetSize( sizeOutput ) constantImageSource2.SetConstant(0.0) source2 = constantImageSource2.Execute() print("Performing reconstruction") feldkamp = srtk.FDKConeBeamReconstructionFilter() feldkamp.SetGeometry( geometry ); feldkamp.SetTruncationCorrection(0.0); feldkamp.SetHannCutFrequency(0.0); image = feldkamp.Execute(source2,reiImage) print("Masking field-of-view") fov = srtk.FieldOfViewImageFilter() fov.SetGeometry(geometry) fov.SetProjectionsStack(reiImage) image = fov.Execute(image) plt.imshow(srtk.GetArrayFromImage(image[:,64,:]), cmap = cm.Greys_r) plt.show() writer = srtk.ImageFileWriter() writer.SetFileName ( sys.argv[1] ) writer.Execute ( image ); http://wiki.openrtk.org/index.php/SimpleRTK Thank you in advance. Best regards, Sareh Borhani -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon.rit at creatis.insa-lyon.fr Mon Apr 17 03:08:25 2017 From: simon.rit at creatis.insa-lyon.fr (Simon Rit) Date: Mon, 17 Apr 2017 09:08:25 +0200 Subject: [Rtk-users] RTK-user In-Reply-To: References: Message-ID: Hi, GetImageFromArray seems to be the good solution. Can you give the code that doesn't work (instead of copy pasting what works from the wiki)? Simon On Sun, Apr 16, 2017 at 10:27 PM, sare Borhani wrote: > Dear RTK.User, > > I'm using python wrapped version of RTK. > > I used the only example of that for reconstruction.It works perfectly. > The problem is that I need to simulate an artifact on projection 2D > images, so first I got each 2D images of stack reiImage by > *srtk.GetArrayFromImage(reiImage) *and then I applied a polynomial on > that to simulate an artifact.NOW need to extract these artifacted-images > again to the simpleRTK image to be able to reconstruct it at the end. I > thought maybe *srtk.GetImageFromArray* works, but it doesn't.Can you pls > help me.I'm really hopeless. > > Here is the Example; > > from __future__ import print_functionimport SimpleRTK as srtkimport sysimport osimport matplotlib.pyplot as pltimport matplotlib.cm as cm > if len ( sys.argv ) < 2: > print( "Usage: RTKFirstReconstruction " ) > sys.exit ( 1 ) > # Defines the RTK geometry object > geometry = srtk.ThreeDCircularProjectionGeometry() > numberOfProjections = 360 > firstAngle = 0 > angularArc = 360 > sid = 600 # source to isocenter distance in mm > sdd = 1200 # source to detector distance in mm > isox = 0 # X coordinate on the projection image of isocenter > isoy = 0 # Y coordinate on the projection image of isocenterfor x in range(0,numberOfProjections): > angle = firstAngle + x * angularArc / numberOfProjections > geometry.AddProjection(sid,sdd,angle,isox,isoy) > > constantImageSource = srtk.ConstantImageSource() > origin = [ -127.5, -127.5, 0. ] > sizeOutput = [ 256, 256, numberOfProjections ] > spacing = [ 1.0, 1.0, 1.0 ] > constantImageSource.SetOrigin( origin ) > constantImageSource.SetSpacing( spacing ) > constantImageSource.SetSize( sizeOutput ) > constantImageSource.SetConstant(0.0) > source = constantImageSource.Execute() > > rei = srtk.RayEllipsoidIntersectionImageFilter() > semiprincipalaxis = [ 50, 50, 50] > center = [ 0, 0, 0]# Set GrayScale value, axes, center... > rei.SetDensity(20) > rei.SetAngle(0) > rei.SetCenter(center) > rei.SetAxis(semiprincipalaxis) > rei.SetGeometry( geometry ) > reiImage = rei.Execute(source) > # Create reconstructed image > constantImageSource2 = srtk.ConstantImageSource() > origin = [ -63.5, -63.5, -63.5 ] > sizeOutput = [ 128, 128, 128 ] > constantImageSource2.SetOrigin( origin ) > constantImageSource2.SetSpacing( spacing ) > constantImageSource2.SetSize( sizeOutput ) > constantImageSource2.SetConstant(0.0) > source2 = constantImageSource2.Execute() > print("Performing reconstruction") > feldkamp = srtk.FDKConeBeamReconstructionFilter() > feldkamp.SetGeometry( geometry ); > feldkamp.SetTruncationCorrection(0.0); > feldkamp.SetHannCutFrequency(0.0); > image = feldkamp.Execute(source2,reiImage) > print("Masking field-of-view") > fov = srtk.FieldOfViewImageFilter() > fov.SetGeometry(geometry) > fov.SetProjectionsStack(reiImage) > image = fov.Execute(image) > > plt.imshow(srtk.GetArrayFromImage(image[:,64,:]), cmap = cm.Greys_r) > plt.show() > > writer = srtk.ImageFileWriter() > writer.SetFileName ( sys.argv[1] ) > writer.Execute ( image ); > > http://wiki.openrtk.org/index.php/SimpleRTK > > > Thank you in advance. > > > Best regards, > Sareh Borhani > > _______________________________________________ > Rtk-users mailing list > Rtk-users at public.kitware.com > http://public.kitware.com/mailman/listinfo/rtk-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From shang_hj at hotmail.com Mon Apr 17 22:39:20 2017 From: shang_hj at hotmail.com (=?gb2312?B?ycwguuq93A==?=) Date: Tue, 18 Apr 2017 02:39:20 +0000 Subject: [Rtk-users] =?gb2312?b?VmFyaWFuoa9zICouc2VxIGZpbGV0eXBl?= Message-ID: Hello RTK?s users, I was using Varian's FPD and it stored a serials of projections as a single *.seq file. Is there anybody using Varian?s *.seq filetype to finish reconstruction? Do you converting the *.seq file into a series *.tiff or use the *.seq file directly? Do you have some descriptions of the .seq filetype and how to convert it to .tiff filetype. Can anyone give me some tips about this question? Thanks in advance. Sam -------------- next part -------------- An HTML attachment was scrubbed... URL: From sareh.borhani at gmail.com Tue Apr 18 03:23:29 2017 From: sareh.borhani at gmail.com (sare Borhani) Date: Tue, 18 Apr 2017 09:23:29 +0200 Subject: [Rtk-users] get simpleRTK image from array Message-ID: Dear RTK.User, I'm using python wrapped version of RTK. I used the only example of that for reconstruction.It works perfectly. The problem is that I need to simulate an artifact on projection 2D images, so first I got each 2D images of stack reiImage by *srtk.GetArrayFromImage(reiImage) *and then I applied a polynomial on that to simulate an artifact.NOW need to extract these artifacted-images again to the simpleRTK image to be able to reconstruct it at the end. I thought maybe *srtk.GetImageFromArray* works, but it doesn't. rei.SetAxis(semiprincipalaxis) rei.SetGeometry( geometry ) reiImage = rei.Execute(source) sampleList = [] for rcount in range(0,127): outputName = '/home/PycharmProjects/test/Sample'+ str(rcount) #plt.imsave(outputName, srtk.GetArrayFromImage(reiImage [:,rcount,:]), cmap='gray') sampleList.append(srtk.GetArrayFromImage(reiImage [:,rcount,:])) test = np.zeros(np.shape(sampleList[0]),dtype=np.float32) bhImages = [] for reiImage1 in sampleList: #img = plt.imread('/home/PycharmProjects/reiOutput/Sample%d'%k) #modifiedImg = sampleList[k] artifactedreiImg= np.zeros(np.shape(reiImage1),dtype=np.float32) for i in range (reiImage1.shape[0]): for j in range (reiImage1.shape[1]): a = reiImage1[i, j] b = (0.00000000018308 * pow(a, 4)) - (0.000000117480729 * pow(a, 3)) + (0.00001747041637 * pow(a, 2)) + 1.000021291118193 * a artifactedreiImg[i, j] = b artifactedreiImg = artifactedreiImg.astype(np.float32) bhImages.append(artifactedreiImg.astype(np.float32)) #plt.imsave(outputName, artifactedreiImg, cmap='gray') *for i,artifactedImage in enumerate(bhImages): bhImage[:,i,:]= srtk.GetImageFromArray(artifactedImage[:,:])* in last lines I tried to get the stack of artifacted images like reiImage and then paste bhImage instead of reiImage for the reconstruction part. But I got this eror message:TypeError: 'tuple' object does not support item assignment First I tried to change the reiImage but it seems its unwritable. Best regards, Sareh Borhani -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon.rit at creatis.insa-lyon.fr Tue Apr 18 07:31:36 2017 From: simon.rit at creatis.insa-lyon.fr (Simon Rit) Date: Tue, 18 Apr 2017 13:31:36 +0200 Subject: [Rtk-users] get simpleRTK image from array In-Reply-To: References: Message-ID: Hi, You need to work with numpy, as explained in the help: >>> import SimpleRTK as srtk >>> help(srtk.GetImageFromArray) Help on function GetImageFromArray in module SimpleRTK.SimpleRTK: GetImageFromArray(arr, isVector=False) Get a SimpleRTK Image from a numpy array. If isVector is True, then a 3D array will be treaded as a 2D vector image, otherwise it will be treaded as a 3D image So in this example, you can obtain what you want by adding import SimpleRTK as srtk at the beginning and then doing a = srtk.GetArrayFromImage(reiImage) b = (0.00000000018308 * np.power(a, 4)) - (0.000000117480729 * np.power(a, 3)) + (0.00001747041637 * np.power(a, 2)) + 1.000021291118193 * a reiImage = srtk.GetImageFromArray(a) This should work. Simon On Tue, Apr 18, 2017 at 9:23 AM, sare Borhani wrote: > Dear RTK.User, > > I'm using python wrapped version of RTK. > > I used the only example of that for reconstruction.It works perfectly. > The problem is that I need to simulate an artifact on projection 2D > images, so first I got each 2D images of stack reiImage by > *srtk.GetArrayFromImage(reiImage) *and then I applied a polynomial on > that to simulate an artifact.NOW need to extract these artifacted-images > again to the simpleRTK image to be able to reconstruct it at the end. I > thought maybe *srtk.GetImageFromArray* works, but it doesn't. > > rei.SetAxis(semiprincipalaxis) > rei.SetGeometry( geometry ) > reiImage = rei.Execute(source) > > sampleList = [] > for rcount in range(0,127): > outputName = '/home/PycharmProjects/test/Sample'+ str(rcount) > #plt.imsave(outputName, srtk.GetArrayFromImage(reiImage [:,rcount,:]), cmap='gray') > sampleList.append(srtk.GetArrayFromImage(reiImage [:,rcount,:])) > > test = np.zeros(np.shape(sampleList[0]),dtype=np.float32) > > bhImages = [] > for reiImage1 in sampleList: > #img = plt.imread('/home/PycharmProjects/reiOutput/Sample%d'%k) > #modifiedImg = sampleList[k] > artifactedreiImg= np.zeros(np.shape(reiImage1),dtype=np.float32) > for i in range (reiImage1.shape[0]): > for j in range (reiImage1.shape[1]): > a = reiImage1[i, j] > b = (0.00000000018308 * pow(a, 4)) - (0.000000117480729 * pow(a, 3)) + (0.00001747041637 * pow(a, 2)) + 1.000021291118193 * a > > artifactedreiImg[i, j] = b > > artifactedreiImg = artifactedreiImg.astype(np.float32) > > bhImages.append(artifactedreiImg.astype(np.float32)) > #plt.imsave(outputName, artifactedreiImg, cmap='gray') > > > *for i,artifactedImage in enumerate(bhImages): bhImage[:,i,:]= srtk.GetImageFromArray(artifactedImage[:,:])* > > in last lines I tried to get the stack of artifacted images like reiImage and then paste bhImage instead of reiImage for the reconstruction part. But I got this eror message:TypeError: 'tuple' object does not support item assignment > > First I tried to change the reiImage but it seems its unwritable. > > Best regards, > Sareh Borhani > > _______________________________________________ > Rtk-users mailing list > Rtk-users at public.kitware.com > http://public.kitware.com/mailman/listinfo/rtk-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreasg at phys.au.dk Tue Apr 18 10:01:09 2017 From: andreasg at phys.au.dk (Andreas Gravgaard Andersen) Date: Tue, 18 Apr 2017 10:01:09 -0400 Subject: [Rtk-users] =?utf-8?q?Varian=E2=80=99s_*=2Eseq_filetype?= In-Reply-To: References: Message-ID: Dear Sam, There are a tiff reader in ITK. You can use that to convert your projections to a format RTK can read (i.e. mha). However, you'll still have to figure out how to get the geometry if you do not have a compatible xml file? I have worked with other Varian image formats (cps, hnd, hnc and xim), but I have not seen a seq file yet. Best regards Andreas __________________________________ Andreas Gravgaard Andersen Department of Oncology, Aarhus University Hospital N?rrebrogade 44, 8000, Aarhus C Mail: andreasg at phys.au.dk Cell: +45 3165 8140 2017-04-17 22:39 GMT-04:00 ? ?? : > Hello RTK?s users, > > I was using Varian's FPD and it stored a serials of projections > as a single *.seq file. Is there anybody using Varian?s *.seq filetype to > finish reconstruction? Do you converting the *.seq file into a series > *.tiff or use the *.seq file directly? Do you have some descriptions of the > .seq filetype and how to convert it to .tiff filetype. Can anyone give me > some tips about this question? Thanks in advance. > > > > > > Sam > > > > _______________________________________________ > Rtk-users mailing list > Rtk-users at public.kitware.com > http://public.kitware.com/mailman/listinfo/rtk-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sareh.borhani at gmail.com Mon Apr 24 01:59:41 2017 From: sareh.borhani at gmail.com (sare Borhani) Date: Mon, 24 Apr 2017 05:59:41 +0000 Subject: [Rtk-users] get simpleRTK image from array In-Reply-To: References: Message-ID: Dear Simon, Thanks Now the problem is that , the new reconstructed image is shown black, although it has mean and max values. What can that problem come from? Best regards, Sareh On Tue, Apr 18, 2017 at 1:31 PM, Simon Rit wrote: > Hi, > You need to work with numpy, as explained in the help: > > >>> import SimpleRTK as srtk > >>> help(srtk.GetImageFromArray) > Help on function GetImageFromArray in module SimpleRTK.SimpleRTK: > > GetImageFromArray(arr, isVector=False) > Get a SimpleRTK Image from a numpy array. If isVector is True, then a > 3D array will be treaded as a 2D vector image, otherwise it will be treaded > as a 3D image > > So in this example, you can obtain what you want by adding > import SimpleRTK as srtk > > at the beginning and then doing > a = srtk.GetArrayFromImage(reiImage) > b = (0.00000000018308 * np.power(a, 4)) - (0.000000117480729 * np.power(a, > 3)) + (0.00001747041637 * np.power(a, 2)) + 1.000021291118193 * a > reiImage = srtk.GetImageFromArray(a) > > This should work. > Simon > > On Tue, Apr 18, 2017 at 9:23 AM, sare Borhani > wrote: > >> Dear RTK.User, >> >> I'm using python wrapped version of RTK. >> >> I used the only example of that for reconstruction.It works perfectly. >> The problem is that I need to simulate an artifact on projection 2D >> images, so first I got each 2D images of stack reiImage by >> *srtk.GetArrayFromImage(reiImage) *and then I applied a polynomial on >> that to simulate an artifact.NOW need to extract these artifacted-images >> again to the simpleRTK image to be able to reconstruct it at the end. I >> thought maybe *srtk.GetImageFromArray* works, but it doesn't. >> >> rei.SetAxis(semiprincipalaxis) >> rei.SetGeometry( geometry ) >> reiImage = rei.Execute(source) >> >> sampleList = [] >> for rcount in range(0,127): >> outputName = '/home/PycharmProjects/test/Sample'+ str(rcount) >> #plt.imsave(outputName, srtk.GetArrayFromImage(reiImage [:,rcount,:]), cmap='gray') >> sampleList.append(srtk.GetArrayFromImage(reiImage [:,rcount,:])) >> >> test = np.zeros(np.shape(sampleList[0]),dtype=np.float32) >> >> bhImages = [] >> for reiImage1 in sampleList: >> #img = plt.imread('/home/PycharmProjects/reiOutput/Sample%d'%k) >> #modifiedImg = sampleList[k] >> artifactedreiImg= np.zeros(np.shape(reiImage1),dtype=np.float32) >> for i in range (reiImage1.shape[0]): >> for j in range (reiImage1.shape[1]): >> a = reiImage1[i, j] >> b = (0.00000000018308 * pow(a, 4)) - (0.000000117480729 * pow(a, 3)) + (0.00001747041637 * pow(a, 2)) + 1.000021291118193 * a >> >> artifactedreiImg[i, j] = b >> >> artifactedreiImg = artifactedreiImg.astype(np.float32) >> >> bhImages.append(artifactedreiImg.astype(np.float32)) >> #plt.imsave(outputName, artifactedreiImg, cmap='gray') >> >> >> *for i,artifactedImage in enumerate(bhImages): bhImage[:,i,:]= srtk.GetImageFromArray(artifactedImage[:,:])* >> >> in last lines I tried to get the stack of artifacted images like reiImage and then paste bhImage instead of reiImage for the reconstruction part. But I got this eror message:TypeError: 'tuple' object does not support item assignment >> >> First I tried to change the reiImage but it seems its unwritable. >> >> Best regards, >> Sareh Borhani >> >> _______________________________________________ >> Rtk-users mailing list >> Rtk-users at public.kitware.com >> http://public.kitware.com/mailman/listinfo/rtk-users >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon.rit at creatis.insa-lyon.fr Tue Apr 25 15:16:23 2017 From: simon.rit at creatis.insa-lyon.fr (Simon Rit) Date: Tue, 25 Apr 2017 21:16:23 +0200 Subject: [Rtk-users] get simpleRTK image from array In-Reply-To: References: Message-ID: Hi, I'm not sure what the problem is. Did you reset the image information before reconstruction, after the GetImageFromArray? reiImage.CopyInformation( source ) This is essential for the reconstruction to have the correct image information, this is used by all geometric operations (projection, backprojection, etc.). Simon On Mon, Apr 24, 2017 at 7:59 AM, sare Borhani wrote: > Dear Simon, > > Thanks > Now the problem is that , the new reconstructed image is shown black, > although it has mean and max values. What can that problem come from? > > Best regards, > Sareh > > On Tue, Apr 18, 2017 at 1:31 PM, Simon Rit > wrote: > >> Hi, >> You need to work with numpy, as explained in the help: >> >> >>> import SimpleRTK as srtk >> >>> help(srtk.GetImageFromArray) >> Help on function GetImageFromArray in module SimpleRTK.SimpleRTK: >> >> GetImageFromArray(arr, isVector=False) >> Get a SimpleRTK Image from a numpy array. If isVector is True, then a >> 3D array will be treaded as a 2D vector image, otherwise it will be treaded >> as a 3D image >> >> So in this example, you can obtain what you want by adding >> import SimpleRTK as srtk >> >> at the beginning and then doing >> a = srtk.GetArrayFromImage(reiImage) >> b = (0.00000000018308 * np.power(a, 4)) - (0.000000117480729 * >> np.power(a, 3)) + (0.00001747041637 * np.power(a, 2)) + 1.000021291118193 * >> a >> reiImage = srtk.GetImageFromArray(a) >> >> This should work. >> Simon >> >> On Tue, Apr 18, 2017 at 9:23 AM, sare Borhani >> wrote: >> >>> Dear RTK.User, >>> >>> I'm using python wrapped version of RTK. >>> >>> I used the only example of that for reconstruction.It works perfectly. >>> The problem is that I need to simulate an artifact on projection 2D >>> images, so first I got each 2D images of stack reiImage by >>> *srtk.GetArrayFromImage(reiImage) *and then I applied a polynomial on >>> that to simulate an artifact.NOW need to extract these artifacted-images >>> again to the simpleRTK image to be able to reconstruct it at the end. I >>> thought maybe *srtk.GetImageFromArray* works, but it doesn't. >>> >>> rei.SetAxis(semiprincipalaxis) >>> rei.SetGeometry( geometry ) >>> reiImage = rei.Execute(source) >>> >>> sampleList = [] >>> for rcount in range(0,127): >>> outputName = '/home/PycharmProjects/test/Sample'+ str(rcount) >>> #plt.imsave(outputName, srtk.GetArrayFromImage(reiImage [:,rcount,:]), cmap='gray') >>> sampleList.append(srtk.GetArrayFromImage(reiImage [:,rcount,:])) >>> >>> test = np.zeros(np.shape(sampleList[0]),dtype=np.float32) >>> >>> bhImages = [] >>> for reiImage1 in sampleList: >>> #img = plt.imread('/home/PycharmProjects/reiOutput/Sample%d'%k) >>> #modifiedImg = sampleList[k] >>> artifactedreiImg= np.zeros(np.shape(reiImage1),dtype=np.float32) >>> for i in range (reiImage1.shape[0]): >>> for j in range (reiImage1.shape[1]): >>> a = reiImage1[i, j] >>> b = (0.00000000018308 * pow(a, 4)) - (0.000000117480729 * pow(a, 3)) + (0.00001747041637 * pow(a, 2)) + 1.000021291118193 * a >>> >>> artifactedreiImg[i, j] = b >>> >>> artifactedreiImg = artifactedreiImg.astype(np.float32) >>> >>> bhImages.append(artifactedreiImg.astype(np.float32)) >>> #plt.imsave(outputName, artifactedreiImg, cmap='gray') >>> >>> >>> *for i,artifactedImage in enumerate(bhImages): bhImage[:,i,:]= srtk.GetImageFromArray(artifactedImage[:,:])* >>> >>> in last lines I tried to get the stack of artifacted images like reiImage and then paste bhImage instead of reiImage for the reconstruction part. But I got this eror message:TypeError: 'tuple' object does not support item assignment >>> >>> First I tried to change the reiImage but it seems its unwritable. >>> >>> Best regards, >>> Sareh Borhani >>> >>> _______________________________________________ >>> Rtk-users mailing list >>> Rtk-users at public.kitware.com >>> http://public.kitware.com/mailman/listinfo/rtk-users >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: