How to return images from file to another file?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to return images from file to another file?

Laurent PAUL

Hi users,

I want to execute filters in a first file and get the result in another one.
So, I have a class which gets callbacks from GUI and call the
corresponding method in another class (and so another file).
This method has to process images and return the result.

A little snippet of code:

in App.h:
void Load_VTK_Volume(const char *directory);
vtkImageData *ReadImage;
read *Lecture; //object from class "read"

in App.cpp:
//This method gets CB and call a method (outside from file)
void Load_VTK_Volume(const char *directory)
{
        Lecture = new read;  //object creation
        ReadImage = Lecture->Load_Dicom_Serie(directory);
}


in read.h:
vtkImageData Load_Dicom_Serie(const char *directory);

in read.cpp:
vtkImageData InOut::Load_Dicom_Serie(const char *directory)
{
        reader2 = vtkDICOMImageReader::New();
        reader2->SetDirectoryName(directory);
        return reader2->GetOutput();
}

This gives me compilation errors:
'vtkImageData::~vtkImageData' : cannot access protected member declared in
class 'vtkImageData'.
binary '=' : no operator defined which takes a right-hand operand of type
'class vtkImageData' (or there is no acceptable conversion).

I think it is a C++ problem, or something I badly understood...

Thanks for your help,

Laurent.

_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: How to return images from file to another file?

Laurent PAUL

Hi Obada,

You were right!
It was just a typo mistake...
I didn't unerstand the compilation errors.

Thank you very much, it works now.

Laurent.

> Hi Laurent,
>
> seems like there is a little typo in your code that causes both compiler
> errors, namely the return type of your `InOut::Load_Dicom_Serie' method:
>
> On Jan 23, 2006, at 5:46 PM, Laurent PAUL wrote:
>  > in read.h:
>  > vtkImageData Load_Dicom_Serie(const char *directory);
>  >
>  > in read.cpp:
>  > vtkImageData InOut::Load_Dicom_Serie(const char *directory)
>
> The return type should be `vtkImageData*'.
>
> The type mismatch that results in the line
>  > ReadImage = Lecture->Load_Dicom_Serie(directory);
> within `Load_VTK_Volume' would cause the compiler to create a local
> variable of type `vtkImageData' which to assign the right-hand side to,
> and then try to find a suitable conversion (which does not exist).  The
> compiler also would generate a destructor call for that hidden local
> variable at the end of its scope, which does not work either, because
> destructors of VTK classes are not declared public (to force you into
> using the `Delete()' method instead).
>
> It is hard to tell from looking at that code snippet if it would work
> generally.
>
>
> Good luck :-)
>
> Obada
>


_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers